Fixed #1972 AS3 Renaming invalid identifiers - '#' character

This commit is contained in:
Jindra Petřík
2023-02-12 22:25:54 +01:00
parent 851dc7e922
commit 14c012ad2f
3 changed files with 16 additions and 12 deletions

View File

@@ -222,7 +222,7 @@ public class IdentifiersDeobfuscation {
}
public String deobfuscateNameWithPackage(boolean as3, String n, HashMap<DottedChain, DottedChain> namesMap, RenameType renameType, Map<DottedChain, DottedChain> selected) {
DottedChain nChain = DottedChain.parseWithSuffix(n);
DottedChain nChain = DottedChain.parseNoSuffix(n);
DottedChain pkg = nChain.getWithoutLast();
String name = nChain.getLast();
@@ -340,7 +340,7 @@ public class IdentifiersDeobfuscation {
usageType = "name";
}
DottedChain sChain = DottedChain.parseWithSuffix(s);
DottedChain sChain = DottedChain.parseNoSuffix(s);
if (selected != null) {
if (selected.containsKey(sChain)) {
return selected.get(sChain).toRawString();
@@ -366,14 +366,14 @@ public class IdentifiersDeobfuscation {
ret = fooString(firstUppercase, rndSize);
if (allVariableNamesStr.contains(ret)
|| isReservedWord(ret, as3)
|| namesMap.containsValue(DottedChain.parseWithSuffix(ret))) {
|| namesMap.containsValue(DottedChain.parseNoSuffix(ret))) {
found = true;
rndSize++;
}
}
} while (found);
namesMap.put(DottedChain.parseWithSuffix(s), DottedChain.parseWithSuffix(ret));
namesMap.put(DottedChain.parseNoSuffix(s), DottedChain.parseNoSuffix(ret));
return ret;
}
}