mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 10:30:46 +00:00
Issue #517 AS1/2 direct editing - delete operator fix, assing after call fix, expressions as commands fix
This commit is contained in:
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model;
|
||||
|
||||
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionDelete;
|
||||
import com.jpexs.decompiler.flash.action.swf5.ActionDelete2;
|
||||
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItemPos;
|
||||
@@ -50,11 +51,11 @@ public class DeleteActionItem extends ActionItem {
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
writer.append("delete ");
|
||||
if (object == null) {
|
||||
return propertyName.toString(writer, localData);
|
||||
return propertyName.toStringNoQuotes(writer, localData);
|
||||
}
|
||||
object.toString(writer, localData);
|
||||
object.toStringNoQuotes(writer, localData);
|
||||
writer.append(".");
|
||||
return stripQuotes(propertyName, localData, writer);
|
||||
return propertyName.toStringNoQuotes(writer, localData);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,6 +68,9 @@ public class DeleteActionItem extends ActionItem {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) {
|
||||
if(object == null){
|
||||
return toSourceMerge(localData, generator, propertyName, new ActionDelete2());
|
||||
}
|
||||
return toSourceMerge(localData, generator, object, propertyName, new ActionDelete());
|
||||
}
|
||||
|
||||
|
||||
@@ -628,6 +628,9 @@ public class ActionScriptParser {
|
||||
if (varDel instanceof GetMemberActionItem) {
|
||||
GetMemberActionItem gm = (GetMemberActionItem) varDel;
|
||||
ret = new DeleteActionItem(null, gm.object, gm.memberName);
|
||||
} else if (varDel instanceof VariableActionItem) {
|
||||
variables.remove(varDel);
|
||||
ret = new DeleteActionItem(null, null, pushConst(((VariableActionItem) varDel).getVariableName()));
|
||||
} else {
|
||||
throw new ParseException("Not a property", lexer.yyline());
|
||||
}
|
||||
@@ -1020,6 +1023,7 @@ public class ActionScriptParser {
|
||||
} else {
|
||||
lexer.pushback(s);
|
||||
var = variable(registerVars, inFunction, inMethod, variables);
|
||||
var = memberOrCall(var, registerVars, inFunction, inMethod, variables);
|
||||
}
|
||||
s = lex();
|
||||
switch (s.type) {
|
||||
@@ -1295,10 +1299,10 @@ public class ActionScriptParser {
|
||||
if (s.type != SymbolType.SEMICOLON) {
|
||||
lexer.pushback(s);
|
||||
}
|
||||
ret = expression(registerVars, inFunction, inMethod, true, variables);
|
||||
if (debugMode) {
|
||||
System.out.println("/command");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (debugMode) {
|
||||
System.out.println("/command");
|
||||
|
||||
Reference in New Issue
Block a user