Example #1
0
        private Expr GenerateParameter(string name, CType CType)
        {
            GetSymbolLoader().GetPredefindType(PredefinedType.PT_STRING);  // force an ensure state
            ExprConstant nameString = GetExprFactory().CreateStringConstant(name);
            ExprTypeOf   pTypeOf    = CreateTypeOf(CType);

            return(GenerateCall(PREDEFMETH.PM_EXPRESSION_PARAMETER, pTypeOf, nameString));
        }
Example #2
0
        private ExprTypeOf CreateTypeOf(ExprClass pSourceType)
        {
            ExprTypeOf rval = new ExprTypeOf(GetTypes().GetReqPredefAgg(PredefinedType.PT_TYPE).getThisType());

            rval.Flags      = EXPRFLAG.EXF_CANTBENULL;
            rval.SourceType = pSourceType;
            return(rval);
        }
Example #3
0
        private ExprTypeOf CreateTypeOf(ExprTypeOrNamespace pSourceType)
        {
            ExprTypeOf rval = new ExprTypeOf();

            rval.Kind       = ExpressionKind.EK_TYPEOF;
            rval.Type       = GetTypes().GetReqPredefAgg(PredefinedType.PT_TYPE).getThisType();
            rval.Flags      = EXPRFLAG.EXF_CANTBENULL;
            rval.SourceType = pSourceType;
            Debug.Assert(rval != null);
            return(rval);
        }
Example #4
0
        private Expr GenerateConstant(Expr expr)
        {
            EXPRFLAG flags = 0;

            AggregateType pObject = GetSymbolLoader().GetPredefindType(PredefinedType.PT_OBJECT);

            if (expr.Type is NullType)
            {
                ExprTypeOf pTypeOf = CreateTypeOf(pObject);
                return(GenerateCall(PREDEFMETH.PM_EXPRESSION_CONSTANT_OBJECT_TYPE, expr, pTypeOf));
            }

            AggregateType stringType = GetSymbolLoader().GetPredefindType(PredefinedType.PT_STRING);

            if (expr.Type != stringType)
            {
                flags = EXPRFLAG.EXF_BOX;
            }

            ExprCast   cast     = GetExprFactory().CreateCast(flags, pObject, expr);
            ExprTypeOf pTypeOf2 = CreateTypeOf(expr.Type);

            return(GenerateCall(PREDEFMETH.PM_EXPRESSION_CONSTANT_OBJECT_TYPE, cast, pTypeOf2));
        }
Example #5
0
 protected override Expr VisitTYPEOF(ExprTypeOf expr)
 {
     Debug.Assert(expr != null);
     return(GenerateConstant(expr));
 }
Example #6
0
 protected virtual Expr VisitTYPEOF(ExprTypeOf pExpr)
 {
     return(VisitEXPR(pExpr));
 }