public virtual bool Get(string varName, out object value, out Type type) { if (_variables.ContainsKey(varName)) { value = _variables[varName]; type = _types[varName]; } else if (_rootObject != null && PropertyHelper.TryGetValue(_rootObject, varName, out value, out type)) { return(true); } else { if (_parentContext == null || !_parentContext.Get(varName, out value, out type)) { value = null; type = typeof(object); return(false); } } if (type == typeof(object) && value != null) { type = value.GetType(); } return(true); }
public override ValueExpression Evaluate(IParserContext context) { object value; Type type; if (!context.Get(VarName, out value, out type)) return new ValueExpression(TokenPosition, null,typeof(object)); return new ValueExpression(TokenPosition, value, type); }
public override ValueExpression Evaluate(IParserContext context) { object value; Type type; if (!context.Get(VarName, out value, out type)) { return(new ValueExpression(TokenPosition, null, typeof(object))); } return(new ValueExpression(TokenPosition, value, type)); }