/// <summary> /// Evaluate a constant. /// </summary> /// <param name="val"></param> /// <returns></returns> public object VisitConstant(ConstantExpr expr) { var val = expr.Value; // 1. Null if (val == LObjects.Null) return val; if (val is LObject) return val; // 2. Actual value. var ltype = LangTypeHelper.ConvertToLangValue(val); return ltype; }
/// <summary> /// Creates a variable expression with symbol scope, context, script refernce set. /// </summary> /// <param name="name"></param> /// <returns></returns> public static Expr Const(LObject obj, TokenData token) { var exp = new ConstantExpr(); exp.Value = obj; SetupContext(exp, token); return exp; }
/// <summary> /// Visits the condition expression tree /// </summary> /// <param name="exp"></param> public object VisitConstant(ConstantExpr exp) { return null; }