mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 19:04:38 +00:00
AS1/2 Delete operator with nonIdentifier parameters (e.g. spaces or obfuscated)
This commit is contained in:
@@ -22,6 +22,7 @@ All notable changes to this project will be documented in this file.
|
||||
- AS1/2 getProperty, setProperty handling
|
||||
- AS1/2 callmethod action arguments
|
||||
- Fixed §§push after continue - should be before (usually on obfuscated code)
|
||||
- AS1/2 Delete operator with nonIdentifier parameters (e.g. spaces or obfuscated)
|
||||
|
||||
## [11.1.0] - 2018-05-24
|
||||
### Added
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -2018,4 +2018,15 @@ public class ActionScript2Test extends ActionScript2TestBase {
|
||||
+ "trace(\"forInSwitchTest\");\r\n"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void frame73_deleteTest() {
|
||||
compareSrc(73, "trace(\"deleteTest\");\r\n"
|
||||
+ "var obj = {a:1,b:2};\r\n"
|
||||
+ "obj[\"salam likum\"] = 58;\r\n"
|
||||
+ "delete obj.a;\r\n"
|
||||
+ "delete obj[\"salam likum\"];\r\n"
|
||||
+ "delete \"bagr aa\";\r\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
BIN
libsrc/ffdec_lib/testdata/as2/as2.fla
vendored
BIN
libsrc/ffdec_lib/testdata/as2/as2.fla
vendored
Binary file not shown.
BIN
libsrc/ffdec_lib/testdata/as2/as2.swf
vendored
BIN
libsrc/ffdec_lib/testdata/as2/as2.swf
vendored
Binary file not shown.
Reference in New Issue
Block a user