From b73832f51eccd5e01b0158688dea8b1e8b27a678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sun, 15 Jan 2023 17:09:19 +0100 Subject: [PATCH] Fixed #1842 AS1/2 use parenthesis when initObject has nonstring keys --- CHANGELOG.md | 1 + .../flash/action/model/InitObjectActionItem.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8483f1d19..38e34efd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ All notable changes to this project will be documented in this file. - [#1937] AS3 - declarations vs null - [#1458] Quick find bar overlaying horizontal scrollbar - [#1842] AS1/2 Better handling obfuscated code, for..in +- [#1842] AS1/2 use parenthesis when initObject has nonstring keys ## [18.3.2] - 2023-01-10 ### Removed diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java index c6e60c07a..075ae910b 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/InitObjectActionItem.java @@ -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("(");