diff options
Diffstat (limited to 'BCT/BytecodeTranslator/ExpressionTraverser.cs')
-rw-r--r-- | BCT/BytecodeTranslator/ExpressionTraverser.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/BCT/BytecodeTranslator/ExpressionTraverser.cs b/BCT/BytecodeTranslator/ExpressionTraverser.cs index 40e13f8a..3db99307 100644 --- a/BCT/BytecodeTranslator/ExpressionTraverser.cs +++ b/BCT/BytecodeTranslator/ExpressionTraverser.cs @@ -897,6 +897,20 @@ namespace BytecodeTranslator #region Translate Unary Operators
+ public override void Visit(ICheckIfInstance checkIfInstance) {
+ var v = this.sink.FindOrCreateType(checkIfInstance.TypeToCheck);
+ //var callTypeOf = new Bpl.NAryExpr(
+ // checkIfInstance.Token(),
+ // new Bpl.FunctionCall(this.sink.Heap.TypeOfFunction),
+ // new Bpl.ExprSeq(new Bpl.IdentifierExpr(checkIfInstance.Token(), v))
+ // );
+ base.Visit(checkIfInstance.Operand);
+ var exp = TranslatedExpressions.Pop();
+ var dynTypeOfOperand = this.sink.Heap.DynamicType(exp);
+ TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Eq, dynTypeOfOperand, new Bpl.IdentifierExpr(checkIfInstance.Token(), v)));
+ return;
+ }
+
public override void Visit(IUnaryNegation unaryNegation)
{
base.Visit(unaryNegation);
|