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)); }
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); }
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); }
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)); }
protected override Expr VisitTYPEOF(ExprTypeOf expr) { Debug.Assert(expr != null); return(GenerateConstant(expr)); }
protected virtual Expr VisitTYPEOF(ExprTypeOf pExpr) { return(VisitEXPR(pExpr)); }