Esempio n. 1
0
        internal static IsVarExpr Bound(Expr expr, TypeExpr type, LocalSymbol var)
        {
            bool?check = null;

            if (expr.Datatype.IsValueType)
            {
                if (Binder.TypesMatch(expr.Datatype, type.Symbol as TypeSymbol))
                {
                    check = true;
                }
                else if (Binder.TypesMatch(type.Symbol as TypeSymbol, Compilation.Get(WellKnownTypes.System_ValueType)))
                {
                    check = true;
                }
                else if (Binder.TypesMatch(type.Symbol as TypeSymbol, Compilation.Get(NativeType.Object)))
                {
                    check = true;
                }
                else
                {
                    check = false;
                }
            }
            return(new IsVarExpr(expr, type, null, null)
            {
                Symbol = type.Symbol, Datatype = Compilation.Get(NativeType.Boolean), Var = var, Check = check
            });
        }
Esempio n. 2
0
 internal static Expr Bound(Expr expr, TypeExpr type)
 {
     return(new AsTypeExpr(expr, type, null)
     {
         Symbol = type.Symbol, Datatype = type.Symbol as TypeSymbol
     });
 }
Esempio n. 3
0
        internal static CtorCallExpr Bound(Binder b, TypeExpr type, ArgList args)
        {
            Expr writeBack;
            var  sym = b.BindCtorCall(type, type.Symbol, args, out writeBack);

            return(new CtorCallExpr(type, args)
            {
                Symbol = sym, Datatype = sym.Type(), WriteBack = writeBack
            });
        }
Esempio n. 4
0
 internal static Expr Bound(Expr expr, TypeExpr type)
 {
     if (expr.Datatype.IsValueType)
     {
         if (Binder.TypesMatch(expr.Datatype, type.Symbol as TypeSymbol))
         {
             return(LiteralExpr.Bound(Constant.Create(true)));
         }
         else if (Binder.TypesMatch(type.Symbol as TypeSymbol, Compilation.Get(WellKnownTypes.System_ValueType)))
         {
             return(LiteralExpr.Bound(Constant.Create(true)));
         }
         else if (Binder.TypesMatch(type.Symbol as TypeSymbol, Compilation.Get(NativeType.Object)))
         {
             return(LiteralExpr.Bound(Constant.Create(true)));
         }
         return(LiteralExpr.Bound(Constant.Create(false)));
     }
     return(new IsExpr(expr, type, null)
     {
         Symbol = type.Symbol, Datatype = Compilation.Get(NativeType.Boolean)
     });
 }
Esempio n. 5
0
 internal AsTypeExpr(Expr e, TypeExpr t, Token o) : base(o)
 {
     Expr = e; Type = t;
 }
Esempio n. 6
0
 internal IsVarExpr(Expr e, TypeExpr t, Token o, Token name) : base(e, t, o)
 {
     Name = name;
 }
Esempio n. 7
0
 internal TypeConversion(TypeExpr t, Expr e) : base(t, e)
 {
 }
Esempio n. 8
0
 internal TypeCast(TypeExpr t, Expr e) : base(t?.Token ?? e.Token)
 {
     Type = t; Expr = e;
 }
Esempio n. 9
0
 internal DefaultExpr(TypeExpr e, Token t) : base(t)
 {
     Type = e;
 }
Esempio n. 10
0
 internal SizeOfExpr(TypeExpr e, Token t) : base(t)
 {
     Type = e;
 }
Esempio n. 11
0
 internal QualifiedNameExpr(TypeExpr e, NameExpr n) : base(n.Token, n.Name, n.Arity)
 {
     Expr = e; Member = n;
 }
Esempio n. 12
0
 internal SwitchBlockType(Token t, Token n, TypeExpr type, Expr when, Stmt s) : base(t, s)
 {
     Name = n;  Type = type; When = when;
 }
Esempio n. 13
0
 internal CtorCallExpr(TypeExpr e, ArgList a) : base(e, a)
 {
 }
Esempio n. 14
0
 internal CatchBlock(Token t, Token name, TypeExpr type, Expr when, Stmt s) : base(t)
 {
     Name = name; Type = type; When = when; Stmt = s;
 }
Esempio n. 15
0
 internal VarDecl(Token t, TypeExpr a) : this(t, t.Value, null, a, null)
 {
 }
Esempio n. 16
0
 internal VarDecl(Token t, Expr[] asub, TypeExpr a, Expr i) : this(t, t.Value, asub, a, i)
 {
 }
Esempio n. 17
0
 internal VarDecl(Token t, string n, Expr[] asub, TypeExpr a, Expr i) : base(t)
 {
     Name = n; ArraySub = asub; Type = a; Initializer = i;
 }
Esempio n. 18
0
 internal LiteralArray(ExprList values, TypeExpr elemType = null) : base(null)
 {
     ElemType = elemType;  Values = values;
 }
Esempio n. 19
0
 internal MemVarDecl(Token t, Expr[] asub, TypeExpr a, Expr i) : base(t, asub, a, i)
 {
 }