Example #1
0
        protected override Variable Evaluate(ParsingScript script)
        {
            Variable varValue = Utils.GetItem(script);

            // Check if the variable to be set has the form of x[a][b]...,
            // meaning that this is an array element.
            List <Variable> arrayIndices = Utils.GetArrayIndices(ref m_name);

            if (arrayIndices.Count == 0)
            {
                ParserFunction.AddGlobalOrLocalVariable(m_name, new GetVarFunction(varValue));
                return(varValue.DeepClone());
            }

            Variable array;

            ParserFunction pf = ParserFunction.GetFunction(m_name);

            if (pf != null)
            {
                array = pf.GetValue(script);
            }
            else
            {
                array = new Variable();
            }

            ExtendArray(array, arrayIndices, 0, varValue);

            ParserFunction.AddGlobalOrLocalVariable(m_name, new GetVarFunction(array));
            return(array);
        }
Example #2
0
        protected override Variable Evaluate(ParsingScript script)
        {
            Variable varValue = Utils.GetItem(script);

            return(varValue.DeepClone());;
        }