mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-07 09:38:09 +00:00
Fixed AS3 - local registers type declarations vs for..in clause
This commit is contained in:
@@ -1776,14 +1776,13 @@ public class AVM2Code implements Cloneable {
|
||||
GraphTargetItem vtype = TypeItem.UNBOUNDED;
|
||||
if (assignment.value instanceof ConvertAVM2Item) {
|
||||
vtype = ((ConvertAVM2Item) assignment.value).type;
|
||||
}
|
||||
|
||||
if (vtype.equals(TypeItem.UNBOUNDED) && (assignment.value instanceof CoerceAVM2Item)) {
|
||||
} else if (assignment.value instanceof CoerceAVM2Item) {
|
||||
vtype = ((CoerceAVM2Item) assignment.value).typeObj;
|
||||
}
|
||||
if (vtype.equals(TypeItem.UNBOUNDED) && (assignment.value instanceof SimpleValue) && ((SimpleValue) assignment.value).isSimpleValue()) {
|
||||
} else if (assignment instanceof LocalRegAVM2Item) { //for..in
|
||||
vtype = ((LocalRegAVM2Item)assignment).type;
|
||||
} else if ((assignment.value instanceof SimpleValue) && ((SimpleValue) assignment.value).isSimpleValue()) {
|
||||
vtype = assignment.value.returnType();
|
||||
}
|
||||
}
|
||||
|
||||
if (declaredRegisters[reg] == null) {
|
||||
declaredRegisters[reg] = new DeclarationAVM2Item(assignment, vtype);
|
||||
|
||||
@@ -699,7 +699,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
|
||||
@Test
|
||||
public void testForInIf() {
|
||||
decompileMethod("classic", "testForInIf", "var a:* = null;\r\n"
|
||||
decompileMethod("classic", "testForInIf", "var a:String = null;\r\n"
|
||||
+ "var arr:Array = [\"a\",\"b\",\"c\"];\r\n"
|
||||
+ "var b:int = 5;\r\n"
|
||||
+ "for(a in arr)\r\n"
|
||||
@@ -733,7 +733,7 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
|
||||
|
||||
@Test
|
||||
public void testForInSwitch() {
|
||||
decompileMethod("classic", "testForInSwitch", "var a:* = null;\r\n"
|
||||
decompileMethod("classic", "testForInSwitch", "var a:String = null;\r\n"
|
||||
+ "var arr:Array = [\"a\",\"b\",\"c\"];\r\n"
|
||||
+ "for(a in arr)\r\n"
|
||||
+ "{\r\n"
|
||||
|
||||
Reference in New Issue
Block a user