mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 08:28:08 +00:00
AS3 direct editation - for(each) in fix, calling types fix
This commit is contained in:
@@ -430,6 +430,10 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
final Reference<Integer> counterReg = new Reference<>(0);
|
||||
final Reference<Integer> collectionReg = new Reference<>(0);
|
||||
|
||||
if(assignable instanceof UnresolvedAVM2Item){
|
||||
assignable = (AssignableAVM2Item)((UnresolvedAVM2Item)assignable).resolved;
|
||||
}
|
||||
|
||||
ret.addAll(GraphTargetItem.toSourceMerge(localData, this,
|
||||
ins(new PushByteIns(), 0),
|
||||
AssignableAVM2Item.setTemp(localData, this, counterReg),
|
||||
|
||||
@@ -173,7 +173,7 @@ public class ActionScriptParser {
|
||||
ret = member(needsActivation, importedClasses, openedNamespaces, ret, registerVars, inFunction, inMethod, variables);
|
||||
break;
|
||||
case PARENT_OPEN:
|
||||
ret = new CallAVM2Item(ret, call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables));
|
||||
ret = new CallAVM2Item(lexer.yyline(),ret, call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables));
|
||||
break;
|
||||
}
|
||||
s = lex();
|
||||
@@ -2007,7 +2007,7 @@ public class ActionScriptParser {
|
||||
case NEW:
|
||||
GraphTargetItem newvar = name(needsActivation, true, openedNamespaces, registerVars, inFunction, inMethod, variables, importedClasses);
|
||||
expectedType(SymbolType.PARENT_OPEN);
|
||||
ret = new ConstructSomethingAVM2Item(openedNamespaces, newvar, call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables));
|
||||
ret = new ConstructSomethingAVM2Item(lexer.yyline(),openedNamespaces, newvar, call(needsActivation, importedClasses, openedNamespaces, registerVars, inFunction, inMethod, variables));
|
||||
existsRemainder = true;
|
||||
break;
|
||||
case IDENTIFIER:
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.jpexs.decompiler.graph.TypeFunctionItem;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -44,11 +45,13 @@ public class CallAVM2Item extends AVM2Item {
|
||||
|
||||
public GraphTargetItem name;
|
||||
public List<GraphTargetItem> arguments;
|
||||
public int line;
|
||||
|
||||
public CallAVM2Item(GraphTargetItem name, List<GraphTargetItem> arguments) {
|
||||
public CallAVM2Item(int line, GraphTargetItem name, List<GraphTargetItem> arguments) {
|
||||
super(null, NOPRECEDENCE);
|
||||
this.name = name;
|
||||
this.arguments = arguments;
|
||||
this.line = line;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,7 +96,12 @@ public class CallAVM2Item extends AVM2Item {
|
||||
p.setAssignedValue(n.getAssignedValue());
|
||||
callable = p;
|
||||
}
|
||||
|
||||
|
||||
if(callable instanceof TypeItem){
|
||||
TypeItem t=(TypeItem)callable;
|
||||
callable = new PropertyAVM2Item(null, t.fullTypeName, g.abc, g.allABCs, new ArrayList<Integer>(), new ArrayList<MethodBody>());
|
||||
}
|
||||
|
||||
if (callable instanceof PropertyAVM2Item) {
|
||||
PropertyAVM2Item prop = (PropertyAVM2Item) callable;
|
||||
Object obj = prop.object;
|
||||
@@ -115,7 +123,7 @@ public class CallAVM2Item extends AVM2Item {
|
||||
Reference<Integer> outPropNsKind = new Reference<>(1);
|
||||
Reference<String> outPropType = new Reference<>("");
|
||||
Reference<ValueKind> outPropValue = new Reference<>(null);
|
||||
if (AVM2SourceGenerator.searchPrototypeChain(true, allAbcs, pkgName, cname, prop.propertyName, outName, outNs, outPropNs, outPropNsKind, outPropType, outPropValue)) {
|
||||
if (AVM2SourceGenerator.searchPrototypeChain(true, allAbcs, pkgName, cname, prop.propertyName, outName, outNs, outPropNs, outPropNsKind, outPropType, outPropValue) && (localData.currentClass.equals("".equals(outNs.getVal())?outName.getVal():outNs.getVal()+"."+outName.getVal()))) {
|
||||
NameAVM2Item nobj = new NameAVM2Item(new TypeItem(localData.currentClass), 0, "this", null, false, new ArrayList<Integer>());
|
||||
nobj.setRegNumber(0);
|
||||
obj = nobj;
|
||||
@@ -127,7 +135,8 @@ public class CallAVM2Item extends AVM2Item {
|
||||
new AVM2Instruction(0, new CallPropertyIns(), new int[]{prop.resolveProperty(localData), arguments.size()}, new byte[0])
|
||||
);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
throw new CompilationException("Cannot call a type", line);
|
||||
//return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -43,8 +43,8 @@ public class ConstructSomethingAVM2Item extends CallAVM2Item {
|
||||
|
||||
public List<Integer> openedNamespaces;
|
||||
|
||||
public ConstructSomethingAVM2Item(List<Integer> openedNamespaces, GraphTargetItem name, List<GraphTargetItem> arguments) {
|
||||
super(name, arguments);
|
||||
public ConstructSomethingAVM2Item(int line,List<Integer> openedNamespaces, GraphTargetItem name, List<GraphTargetItem> arguments) {
|
||||
super(line,name, arguments);
|
||||
this.openedNamespaces = openedNamespaces;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,11 +143,7 @@ public class NameAVM2Item extends AssignableAVM2Item {
|
||||
public int getNsKind() {
|
||||
return nsKind;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAssignedValue(GraphTargetItem storeValue) {
|
||||
this.assignedValue = storeValue;
|
||||
}
|
||||
|
||||
|
||||
public String getVariableName() {
|
||||
return variableName;
|
||||
|
||||
Reference in New Issue
Block a user