From 11d5a55564cd66f62be0aa3466dcd704f08991d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 28 Nov 2021 16:39:35 +0100 Subject: [PATCH] Fixed AS1/2 - direct editation - allow call on numbers, boolean, etc. --- CHANGELOG.md | 3 ++- .../flash/action/model/CallFunctionActionItem.java | 3 --- .../action/parser/script/ActionScript2Parser.java | 13 +++++++------ .../flash/importers/AS2ScriptImporter.java | 2 ++ 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90708336b..30bfa53d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,9 +29,10 @@ All notable changes to this project will be documented in this file. - AS1/2 - nested tellTarget - AS1/2 - switch with nontrivial expressions like and/or,ternar (second pass) - AS1/2 - ifFrameLoaded with nontrivial items inside -- AS1/2 - (mb)length is expressioncommand, not a command +- AS1/2 - direct editation - (mb)length is expressioncommand, not a command - AS1/2 - get/set top level properties - AS1/2 - properties postincrement +- AS1/2 - direct editation - allow call on numbers, boolean, etc. ## [14.6.0] - 2021-11-22 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java index 4881c2f55..5c0e52a7e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallFunctionActionItem.java @@ -69,13 +69,10 @@ public class CallFunctionActionItem extends ActionItem { if (functionName instanceof DirectValueActionItem) { if (!IdentifiersDeobfuscation.isValidName(false, (functionName).toStringNoQuotes(localData))) { - writer.append("eval("); functionName.toString(writer, localData); - writer.append(")"); } else { functionName.toStringNoQuotes(writer, localData); } - //writer.append(IdentifiersDeobfuscation.printIdentifier(false, (functionName).toStringNoQuotes(localData))); } else { functionName.appendTry(writer, localData); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java index 68703c71f..985438d72 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/parser/script/ActionScript2Parser.java @@ -1801,18 +1801,19 @@ public class ActionScript2Parser { break; case TRUE: ret = new DirectValueActionItem(null, null, 0, Boolean.TRUE, new ArrayList<>()); - + allowMemberOrCall = true; break; case NULL: ret = new DirectValueActionItem(null, null, 0, Null.INSTANCE, new ArrayList<>()); - + allowMemberOrCall = true; break; case UNDEFINED: ret = new DirectValueActionItem(null, null, 0, Undefined.INSTANCE, new ArrayList<>()); + allowMemberOrCall = true; break; case FALSE: ret = new DirectValueActionItem(null, null, 0, Boolean.FALSE, new ArrayList<>()); - + allowMemberOrCall = true; break; case CURLY_OPEN: //Object literal s = lex(); @@ -1863,16 +1864,16 @@ public class ActionScript2Parser { break; case NAN: ret = new DirectValueActionItem(null, null, 0, Double.NaN, new ArrayList<>()); - + allowMemberOrCall = true; break; case INFINITY: ret = new DirectValueActionItem(null, null, 0, Double.POSITIVE_INFINITY, new ArrayList<>()); - + allowMemberOrCall = true; break; case INTEGER: case DOUBLE: ret = new DirectValueActionItem(null, null, 0, s.value, new ArrayList<>()); - + allowMemberOrCall = true; break; case DELETE: GraphTargetItem varDel = expressionPrimary(false, inFunction, inMethod, inTellTarget, false, variables, functions, true, hasEval); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/AS2ScriptImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/AS2ScriptImporter.java index aeb0e6b3f..da6974fc8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/AS2ScriptImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/AS2ScriptImporter.java @@ -82,6 +82,8 @@ public class AS2ScriptImporter { logger.log(Level.SEVERE, "%error% on line %line%, file: %file%".replace("%error%", ex.text).replace("%line%", Long.toString(ex.line)).replace("%file%", fileName), ex); } catch (IOException ex) { logger.log(Level.SEVERE, "error during script import, file: %file%".replace("%file%", fileName), ex); + } catch (Exception ex) { + logger.log(Level.SEVERE, "error during script import, file: %file%".replace("%file%", fileName), ex); } asm.setModified();