AS1/2 Delete operator with nonIdentifier parameters (e.g. spaces or obfuscated)

This commit is contained in:
Jindra Petřík
2018-05-27 22:42:26 +02:00
parent f61772c8f7
commit f48c92df27
6 changed files with 35 additions and 6 deletions

View File

@@ -12,9 +12,11 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.action.model;
import com.jpexs.decompiler.flash.IdentifiersDeobfuscation;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.action.swf5.ActionDelete;
import com.jpexs.decompiler.flash.action.swf5.ActionDelete2;
@@ -55,12 +57,25 @@ public class DeleteActionItem extends ActionItem {
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
writer.append("delete ");
writer.append("delete ");
if (object == null) {
if (object != null) {
object.toStringNoQuotes(writer, localData);
if (IdentifiersDeobfuscation.isValidName(false, propertyName.toStringNoQuotes(localData))) {
writer.append(".");
propertyName.toStringNoQuotes(writer, localData);
} else {
writer.append("[");
propertyName.toString(writer, localData);
writer.append("]");
}
return writer;
}
}
object.toStringNoQuotes(writer, localData);
writer.append(".");
if (IdentifiersDeobfuscation.isValidName(false, propertyName.toStringNoQuotes(localData))) {
propertyName.toStringNoQuotes(writer, localData);
} else {
propertyName.toString(writer, localData);
}
return writer;
}
@Override

View File

@@ -606,6 +606,8 @@ public class ActionScript2Parser {
} else if (varDel instanceof VariableActionItem) {
variables.remove(varDel);
ret = new DeleteActionItem(null, null, null, pushConst(((VariableActionItem) varDel).getVariableName()));
} else if (varDel instanceof DirectValueActionItem) {
ret = new DeleteActionItem(null, null, null, varDel);
} else {
throw new ActionParseException("Not a property", lexer.yyline());
}