Implement TypeOf and ConvertType instructions

This commit is contained in:
Yoshi Askharoun
2025-08-02 21:34:17 -05:00
parent eede0200d2
commit 810fc8b802
2 changed files with 17 additions and 0 deletions
+15
View File
@@ -396,6 +396,21 @@ partial class Decompiler
));
break;
case OpCode.TypeOf:
var typeOfSchema = _context.GetImportedType(instruction.Operands.First());
var typeOfExpr = TypeOfExpression(IrisExpression.ToSyntax(typeOfSchema, _context));
stack.Push(typeOfExpr);
break;
case OpCode.ConvertType:
var destinationTypeSchema = _context.GetImportedType(instruction.Operands.First());
var typeCastExpr = CastExpression(
IrisExpression.ToSyntax(destinationTypeSchema, _context),
Parenthesize(IrisExpression.ToSyntax(stack.Pop(), _context))
);
stack.Push(typeCastExpr);
break;
default:
return false;
}