コード例 #1
0
ファイル: Assignment.cs プロジェクト: djlw78/crayon
        internal override IList <Executable> Resolve(ParserContext parser)
        {
            this.Target = this.Target.Resolve(parser);

            switch (this.type)
            {
            case AssignmentType.VARIABLE:
            case AssignmentType.TYPED_VARIABLE_DECLARATION:
                this.Target = this.Target.Resolve(parser);
                break;

            case AssignmentType.KEYED_ASSIGNMENT:
                BracketIndex bi = (BracketIndex)this.Target;
                bi.Root  = bi.Root.Resolve(parser);
                bi.Index = bi.Index.Resolve(parser);
                break;

            case AssignmentType.FIELD_ASSIGNMENT:
                if (this.Target is DotField)
                {
                    DotField ds = (DotField)this.Target;
                    ds.Root = ds.Root.Resolve(parser);
                }
                else if (this.Target is FieldReference)
                {
                    // nothing to do.
                }
                else
                {
                    throw new ParserException(this, "Unexpected assignment target");
                }
                break;

            default:
                throw new System.Exception();
            }

            this.Value = this.Value.Resolve(parser);

            return(Listify(this));
        }
コード例 #2
0
        internal override IList <Executable> Resolve(ParserContext parser)
        {
            this.Target = this.Target.Resolve(parser);

            if (this.Target is Variable)
            {
                this.Target = this.Target.Resolve(parser);
            }
            else if (this.Target is BracketIndex)
            {
                BracketIndex bi = this.Target as BracketIndex;
                bi.Root  = bi.Root.Resolve(parser);
                bi.Index = bi.Index.Resolve(parser);
            }
            else if (this.Target is DotStep)
            {
                DotStep ds = this.Target as DotStep;
                ds.Root = ds.Root.Resolve(parser);
            }

            this.Value = this.Value.Resolve(parser);

            return(Listify(this));
        }