From 7504bb63d30c60e6bae735ad4a1df50e420dfa8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 21 Nov 2021 10:53:14 +0100 Subject: [PATCH] Fixed AS1/2 direct editation - postincrement/decrement --- CHANGELOG.md | 1 + .../parser/script/ActionScript2Parser.java | 34 ++++++++++--------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5660ce5eb..3fb942441 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Japanese in english locales for Gotoaddress, addclass dialog - AS1/2 DefineFunction cleaner +- AS1/2 direct editation - postincrement/decrement ## [14.5.2] - 2021-11-20 ### Fixed 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 a2860e782..6408f8f2e 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 @@ -1598,22 +1598,6 @@ public class ActionScript2Parser { } } - switch (lookahead.type) { - case INCREMENT: //postincrement - lex(); - if (!(lhs instanceof VariableActionItem) && !(lhs instanceof GetMemberActionItem)) { - throw new ActionParseException("Invalid assignment", lexer.yyline()); - } - lhs = new PostIncrementActionItem(null, null, lhs); - break; - case DECREMENT: //postdecrement - lex(); - if (!(lhs instanceof VariableActionItem) && !(lhs instanceof GetMemberActionItem)) { - throw new ActionParseException("Invalid assignment", lexer.yyline()); - } - lhs = new PostDecrementActionItem(null, null, lhs); - break; - } if (debugMode) { System.out.println("/expression1"); } @@ -2007,6 +1991,24 @@ public class ActionScript2Parser { } op = lex(); } + + switch (op.type) { + case INCREMENT: //postincrement + if (!(ret instanceof VariableActionItem) && !(ret instanceof GetMemberActionItem)) { + throw new ActionParseException("Invalid assignment", lexer.yyline()); + } + ret = new PostIncrementActionItem(null, null, ret); + op = lex(); + break; + case DECREMENT: //postdecrement + if (!(ret instanceof VariableActionItem) && !(ret instanceof GetMemberActionItem)) { + throw new ActionParseException("Invalid assignment", lexer.yyline()); + } + ret = new PostDecrementActionItem(null, null, ret); + op = lex(); + break; + } + lexer.pushback(op); return ret; }