From 079b0d0b368e13e9fdcc960997dae6b0d3ef9ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 8 Jun 2025 14:52:32 +0200 Subject: [PATCH] [] and () separated --- .../script/ActionScript3SimpleParser.java | 4 +- .../flash/simpleparser/Variable.java | 39 +++---------------- 2 files changed, 7 insertions(+), 36 deletions(-) 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 2e6a61115..37157eb4e 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 @@ -121,7 +121,7 @@ public class ActionScript3SimpleParser implements SimpleParser { break; case PARENT_OPEN: call(errors, thisType, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, isStatic, variables, abc); - lastVarName += "()"; + lastVarName += ".()"; ret = true; break; case DESCENDANTS: @@ -215,7 +215,7 @@ public class ActionScript3SimpleParser implements SimpleParser { ret = true; s = lex(); } else if (s.type == SymbolType.BRACKET_OPEN) { - lastVarName += "[]"; + lastVarName += ".[]"; expression(errors, thisType, needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, isStatic, true, variables, false, abc); expectedType(errors, SymbolType.BRACKET_CLOSE); ret = true; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/simpleparser/Variable.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/simpleparser/Variable.java index 563d5404c..41770c102 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/simpleparser/Variable.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/simpleparser/Variable.java @@ -61,11 +61,7 @@ public class Variable implements VariableOrScope { String ret = name; if (ret.contains(".")) { ret = ret.substring(ret.lastIndexOf(".") + 1); - } - - if (ret.endsWith("()") || ret.endsWith("[]")) { - ret = ret.substring(0, ret.length() - 2); - } + } return ret; } @@ -73,21 +69,10 @@ public class Variable implements VariableOrScope { String ret = name; if (ret.contains(".")) { ret = ret.substring(0, ret.indexOf(".")); - } - if (ret.endsWith("()") || ret.endsWith("[]")) { - ret = ret.substring(0, ret.length() - 2); - } + } return ret; } - - public boolean firstNameIsCall() { - String ret = name; - if (ret.contains(".")) { - ret = ret.substring(0, ret.indexOf(".")); - } - return ret.endsWith("()"); - } - + public String getParentName() { if (name.contains(".")) { return name.substring(0, name.lastIndexOf(".")); @@ -96,24 +81,10 @@ public class Variable implements VariableOrScope { } public List getParts() { - List ret = new ArrayList<>(); - - String[] dotSplit = name.split("\\.", -1); - Pattern pat = Pattern.compile("[^\\(\\)\\[\\]]+|\\(\\)|\\[\\]"); - for (String s : dotSplit) { - Matcher m = pat.matcher(s); - while (m.find()) { - ret.add(m.group()); - } - } - return ret; + return Arrays.asList(name.split("\\.", -1)); } public boolean hasParent() { return name.contains("."); - } - - public static void main(String[] args) { - String v = "v.getPoint().x"; - } + } }