Example #1
0
        public void Set(ParserValue obj, string varName, ParserValue indexer, ParserValue result)
        {
            if (!this.Enabled)
            {
                return;
            }

            if (obj is StaticClass)
            {
                StaticClass staticClass = (StaticClass)obj;
                Type        type        = staticClass.Type;
                if (type == null)
                {
                    Fail("Couldn't get type for: " + staticClass.Type.FullName);
                }
                if (!SetStaticField(type, varName, result))
                {
                    obj = CurrentScope.Get(staticClass.Name);
                }
                else
                {
                    return;
                }
            }

            if (indexer.IsNotNull)
            {
                obj = Get(obj, varName, ParserValue.Empty);
                SetIndex(obj, indexer, result);
            }
            else
            {
                if (obj.IsNull)
                {
                    CurrentScope.Set(varName, result);
                }
                else
                {
                    if (!SetField(obj, varName, result))
                    {
                        Fail("Couldn't find field: " + varName);
                    }
                }
            }
        }