Fixed AS3 - local registers type declarations vs for..in clause

This commit is contained in:
Jindra Petřík
2023-01-13 18:44:33 +01:00
parent 5d428eaa8b
commit e9568e413b
3 changed files with 8 additions and 8 deletions

View File

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