Added: AS3 direct editation - unary plus support

This commit is contained in:
Jindra Petřík
2024-08-11 11:16:50 +02:00
parent 8cfbdf5f4e
commit 3e7493d595
5 changed files with 170 additions and 142 deletions

View File

@@ -146,6 +146,8 @@ public class CoerceAVM2Item extends AVM2Item {
case "int":
case "uint":
case "Number":
case "float":
case "float4":
return value.isConvertedCompileTime(dependencies);
}
return false;
@@ -215,6 +217,19 @@ public class CoerceAVM2Item extends AVM2Item {
case "Number":
ins = new AVM2Instruction(0, AVM2Instructions.ConvertD, null);
break;
case "float":
ins = new AVM2Instruction(0, AVM2Instructions.ConvertF, null);
break;
case "float4":
ins = new AVM2Instruction(0, AVM2Instructions.ConvertF4, null);
break;
case "decimal":
if (localData.numberContext != null) {
ins = new AVM2Instruction(0, AVM2Instructions.ConvertMP, new int[] {localData.numberContext});
} else {
ins = new AVM2Instruction(0, AVM2Instructions.ConvertM, null);
}
break;
default:
int type_index = AVM2SourceGenerator.resolveType(localData, typeObj, ((AVM2SourceGenerator) generator).abcIndex);
ins = new AVM2Instruction(0, AVM2Instructions.Coerce, new int[]{type_index});