From b7657a95802292ddae0049f488bd3bc526c5ada4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 24 Sep 2024 22:08:22 +0200 Subject: [PATCH] Fixed: #2322 AS3 Construct property name formatting --- CHANGELOG.md | 2 ++ .../construction/ConstructPropIns.java | 2 +- .../abc/avm2/model/ConstructPropAVM2Item.java | 15 +++++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d65bac2c..f2cc65a52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. - [#2319] AS3 direct editation - class gets removed after pressing cancel - [#2320] AS3 direct editation - modified flag of scripts vanishes after editing other script with and having error - [#2272] Filters strength attribute caps at 100% +- [#2322] AS3 Construct property name formatting ## [21.1.0] - 2024-09-23 ### Added @@ -3582,6 +3583,7 @@ Major version of SWF to XML export changed to 2. [#2319]: https://www.free-decompiler.com/flash/issues/2319 [#2320]: https://www.free-decompiler.com/flash/issues/2320 [#2272]: https://www.free-decompiler.com/flash/issues/2272 +[#2322]: https://www.free-decompiler.com/flash/issues/2322 [#943]: https://www.free-decompiler.com/flash/issues/943 [#1812]: https://www.free-decompiler.com/flash/issues/1812 [#2287]: https://www.free-decompiler.com/flash/issues/2287 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java index 6772d3847..d5f17940d 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java @@ -109,7 +109,7 @@ public class ConstructPropIns extends InstructionDefinition { if (obj instanceof FindPropertyAVM2Item) { multiname.property = false; //can be type } - stack.push(new ConstructPropAVM2Item(ins, localData.lineStartInstruction, obj, multiname, args, type.getVal())); + stack.push(new ConstructPropAVM2Item(ins, localData.lineStartInstruction, obj, multiname, args, type.getVal(), isStatic.getVal())); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java index ccff6ce8f..aafb07850 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/ConstructPropAVM2Item.java @@ -50,6 +50,11 @@ public class ConstructPropAVM2Item extends AVM2Item { * Type */ public GraphTargetItem type; + + /** + * Is static + */ + public boolean isStatic; /** * Constructor. @@ -60,13 +65,15 @@ public class ConstructPropAVM2Item extends AVM2Item { * @param propertyName Property name * @param args Arguments * @param type Type + * @param isStatic Is static */ - public ConstructPropAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object, GraphTargetItem propertyName, List args, GraphTargetItem type) { + public ConstructPropAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object, GraphTargetItem propertyName, List args, GraphTargetItem type, boolean isStatic) { super(instruction, lineStartIns, PRECEDENCE_PRIMARY); this.object = object; this.propertyName = propertyName; this.args = args; this.type = type; + this.isStatic = isStatic; } @Override @@ -79,11 +86,7 @@ public class ConstructPropAVM2Item extends AVM2Item { @Override public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException { writer.append("new "); - if (!(object.getThroughDuplicate() instanceof FindPropertyAVM2Item)) { - object.toString(writer, localData); - writer.append("."); - } - propertyName.toString(writer, localData); + formatProperty(writer, object, propertyName, localData, isStatic); writer.spaceBeforeCallParenthesies(args.size()); writer.append("("); for (int a = 0; a < args.size(); a++) {