From a422b33f17880eec6aa91debafe1ff3e8a9a52da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 20 Jul 2025 20:19:40 +0200 Subject: [PATCH] Fixed: AS3 direct editation - Allow some special words (like `override`) as identifiers --- CHANGELOG.md | 1 + .../parser/script/ActionScript3Parser.java | 22 +++++++++++-------- .../script/ActionScript3SimpleParser.java | 6 ++++- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c7a3c11e..df4c53f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ All notable changes to this project will be documented in this file. - [#2486] AS3 switches detection in some cases - AS1/2 Hide icons panel when editing - AS1/2 both pcode and AS editable at the same time +- AS3 direct editation - Allow some special words (like `override`) as identifiers ### Changed - Icon of "Deobfuscation options" menu from pile of pills to medkit diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index 82fff2a44..2258ccb05 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -2713,18 +2713,22 @@ public class ActionScript3Parser { ret = name(allOpenedNamespaces, thisType, pkg, needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses, abc); allowMemberOrCall = true; - //var = memberOrCall(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, var, registerVars, inFunction, inMethod, variables); - //ret = var; break; default: - GraphTargetItem excmd = expressionCommands(s, registerVars, inFunction, inMethod, -1, variables); - if (excmd != null) { - //? - ret = excmd; - allowMemberOrCall = true; //? - break; + if (s.isType(SymbolGroup.IDENTIFIER)) { + lexer.pushback(s); + ret = name(allOpenedNamespaces, thisType, pkg, needsActivation, false, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses, abc); + allowMemberOrCall = true; + } else { + GraphTargetItem excmd = expressionCommands(s, registerVars, inFunction, inMethod, -1, variables); + if (excmd != null) { + //? + ret = excmd; + allowMemberOrCall = true; //? + break; + } + lexer.pushback(s); } - lexer.pushback(s); } if (allowMemberOrCall && ret != null) { ret = memberOrCall(allOpenedNamespaces, thisType, pkg, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables, abc); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3SimpleParser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3SimpleParser.java index b153f5dba..5e4782860 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3SimpleParser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3SimpleParser.java @@ -47,7 +47,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.Stack; /** @@ -2123,6 +2122,11 @@ public class ActionScript3SimpleParser implements SimpleParser { break; default: lexer.pushback(s); + if (s.isType(SymbolGroup.IDENTIFIER)) { + lastVarName = name(errors, thisType, needsActivation, openedNamespaces, registerVars, inFunction, inMethod, isStatic, variables, importedClasses, abc); + ret = true; + allowMemberOrCall = true; + } } if (allowMemberOrCall && ret) { memberOrCall(lastVarName, errors, thisType, needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, isStatic, variables, abc);