BoundExpression BindInstanceOfEx(AST.InstanceOfEx x) { var result = new BoundInstanceOfEx(BindExpression(x.Expression, BoundAccess.Read)); if (x.ClassNameRef is AST.DirectTypeRef) { result.IsTypeDirect = ((AST.DirectTypeRef)x.ClassNameRef).ClassName; } else { result.IsTypeIndirect = BindExpression(((AST.IndirectTypeRef)x.ClassNameRef).ClassNameVar, BoundAccess.Read); } // return(result); }
public virtual void VisitInstanceOf(BoundInstanceOfEx x) { Accept(x.Operand); VisitTypeRef(x.AsType); }
public virtual TResult VisitInstanceOf(BoundInstanceOfEx x) => DefaultVisitOperation(x);
protected virtual void Visit(BoundInstanceOfEx x, ConditionBranch branch) { base.VisitInstanceOf(x); }
public sealed override void VisitInstanceOf(BoundInstanceOfEx x) => Visit(x, ConditionBranch.Default);
public virtual void VisitInstanceOf(BoundInstanceOfEx x) { Accept(x.Operand); VisitTypeRef(x.AsType); }
protected override void Visit(BoundInstanceOfEx x, ConditionBranch branch) { Accept(x.Operand); VisitTypeRef(x.AsType); // TOOD: x.ConstantValue // in case we know and the operand is a local variable (we can ignore the expression and emit result immediatelly) if (branch == ConditionBranch.ToTrue && x.Operand is BoundVariableRef) { var vref = (BoundVariableRef)x.Operand; if (vref.Name.IsDirect) { // if (Variable is T) => variable is T in True branch state State.SetVar(vref.Name.NameValue.Value, TypeCtx.GetTypeMask(x.AsType.TypeRef, true)); } } // x.TypeRefMask = TypeCtx.GetBooleanTypeMask(); }