mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-27 16:30:46 +00:00
Fixed: #2301 AS3 direct editing - instance variables assignments producing additional static assignments
This commit is contained in:
committed by
Jindra Petřík
parent
8eabe85311
commit
9d421bb23a
+4
-11
@@ -808,7 +808,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
|
||||
//List<AVM2Instruction> cinitcode = new ArrayList<>();
|
||||
List<AVM2Instruction> initcode = new ArrayList<>();
|
||||
/*for (GraphTargetItem ti : commands) {
|
||||
for (GraphTargetItem ti : commands) {
|
||||
if ((ti instanceof SlotAVM2Item) || (ti instanceof ConstAVM2Item)) {
|
||||
GraphTargetItem val = null;
|
||||
boolean isStatic = false;
|
||||
@@ -831,12 +831,13 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (isStatic && val != null) {
|
||||
/*if (isStatic && val != null) {
|
||||
cinitcode.add(ins(AVM2Instructions.FindProperty, traitName(ns, tname)));
|
||||
localData.isStatic = true;
|
||||
cinitcode.addAll(toInsList(val.toSource(localData, this)));
|
||||
cinitcode.add(ins(isConst ? AVM2Instructions.InitProperty : AVM2Instructions.SetProperty, traitName(ns, tname)));
|
||||
}
|
||||
*/
|
||||
if (!isStatic && val != null) {
|
||||
//do not init basic values, that can be stored in trait
|
||||
if (!(val instanceof IntegerValueAVM2Item) && !(val instanceof StringAVM2Item) && !(val instanceof BooleanAVM2Item) && !(val instanceof NullAVM2Item) && !(val instanceof UndefinedAVM2Item)) {
|
||||
@@ -846,16 +847,8 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
initcode.add(ins(isConst ? AVM2Instructions.InitProperty : AVM2Instructions.SetProperty, traitName(ns, tname)));
|
||||
}
|
||||
}
|
||||
} else if (ti instanceof MethodAVM2Item) {
|
||||
//ignore
|
||||
} else {
|
||||
localData.isStatic = true;
|
||||
List<GraphSourceItem> srcs = ti.toSourceIgnoreReturnValue(localData, this);
|
||||
for (GraphSourceItem src : srcs) {
|
||||
cinitcode.add((AVM2Instruction)src);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
MethodBody initBody = null;
|
||||
if (!isInterface) {
|
||||
initBody = abcIndex.getSelectedAbc().findBody(init);
|
||||
|
||||
+6
@@ -128,11 +128,17 @@ public class ConstAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
|
||||
if (localData.isStatic != isStatic) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
AVM2SourceGenerator agen = (AVM2SourceGenerator) generator;
|
||||
int ns = agen.genNs(localData.importedClasses, pkg.name, pkg, localData.openedNamespaces, localData, line);
|
||||
if (type.toString().equals("Namespace")) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
List<GraphSourceItem> ret = new ArrayList<>();
|
||||
if (value != null) {
|
||||
|
||||
+7
-2
@@ -120,9 +120,14 @@ public class SlotAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData, SourceGenerator generator) throws CompilationException {
|
||||
|
||||
if (localData.isStatic != isStatic) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
AVM2SourceGenerator agen = (AVM2SourceGenerator) generator;
|
||||
int ns = agen.genNs(localData.importedClasses, pkg.name, pkg, localData.openedNamespaces, localData, line);
|
||||
|
||||
int ns = agen.genNs(localData.importedClasses, pkg.name, pkg, localData.openedNamespaces, localData, line);
|
||||
|
||||
List<GraphSourceItem> ret = new ArrayList<>();
|
||||
if (value != null) {
|
||||
ret.add(ins(AVM2Instructions.FindProperty, agen.traitName(ns, var)));
|
||||
|
||||
Reference in New Issue
Block a user