示例#1
0
        public virtual object GetValue(string name, out CFLType type)
        {
            if (!_vStack.ContainsKey(name))
            {
                throw new InvalidOperationException("Cannot retrieve value of undefined variable.");
            }

            VariableInfo i = _vStack[name];

            type = i.Type;
            return(_stack[i]);
        }
示例#2
0
        private VariableInfo SetVariableAndType(string name, CFLType type, bool fix = false, bool over = true)
        {
            if (_vStack.ContainsKey(name))
            {
                if (over)
                {
                    VariableInfo i = _vStack[name];
                    i.Type    = type;
                    _stack[i] = null;
                    return(i);
                }
                else
                {
                    throw new InvalidOperationException("One scope may not contain two variables with same name.");
                }
            }

            VariableInfo info = new VariableInfo(name, this, fix);

            info.Type = type;
            _stack.Add(info, null);
            _vStack.Add(name, info);
            return(info);
        }