Fixed: #2322 AS3 Construct property name formatting

This commit is contained in:
Jindra Petřík
2024-09-24 22:08:22 +02:00
parent cec2fd0011
commit b7657a9580
3 changed files with 12 additions and 7 deletions

View File

@@ -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

View File

@@ -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<GraphTargetItem> args, GraphTargetItem type) {
public ConstructPropAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, GraphTargetItem object, GraphTargetItem propertyName, List<GraphTargetItem> 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++) {