Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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));
        }