Fixed #1842 AS1/2 use parenthesis when initObject has nonstring keys

This commit is contained in:
Jindra Petřík
2023-01-15 17:09:19 +01:00
parent b37771c9a6
commit b73832f51e
2 changed files with 10 additions and 2 deletions

View File

@@ -63,8 +63,15 @@ public class InitObjectActionItem extends ActionItem {
if (i < values.size() - 1) {
writer.append(",");
}
//AS1/2 does not allow quotes in name here
writer.append(IdentifiersDeobfuscation.printIdentifier(false, names.get(i).toStringNoQuotes(localData)));
//AS1/2 does not allow quotes in name here
if ((names.get(i) instanceof DirectValueActionItem)
&&(((DirectValueActionItem)names.get(i)).isSimpleValue())) {
writer.append(IdentifiersDeobfuscation.printIdentifier(false, names.get(i).toStringNoQuotes(localData)));
} else {
writer.append("(");
names.get(i).appendTo(writer, localData);
writer.append(")");
}
writer.append(":");
if (values.get(i) instanceof TernarOpItem) { //Ternar operator contains ":"
writer.append("(");