Beispiel #1
0
        internal override IList <Executable> Resolve(ParserContext parser)
        {
            this.ValueStackDepth = parser.ValueStackDepth;

            this.TryBlock = Executable.Resolve(parser, this.TryBlock).ToArray();
            foreach (CatchBlock cb in this.CatchBlocks)
            {
                cb.Code = Executable.Resolve(parser, cb.Code).ToArray();
            }
            this.FinallyBlock = Executable.Resolve(parser, this.FinallyBlock).ToArray();

            return(this.TryBlock.Length == 0
                ? this.FinallyBlock // No try? The finally then just functions as normal unwrapped code.
                : Listify(this));
        }
Beispiel #2
0
        internal override void Resolve(ParserContext parser)
        {
            parser.ValueStackDepth = 0;

            this.FunctionID = parser.GetNextFunctionId();

            for (int i = 0; i < this.DefaultValues.Length; ++i)
            {
                if (this.DefaultValues[i] != null)
                {
                    this.DefaultValues[i] = this.DefaultValues[i].Resolve(parser);
                }
            }

            this.Code = Executable.Resolve(parser, this.Code).ToArray();
            this.Code = Executable.EnsureBlockReturns(this.Code, this);
        }
        internal override void Resolve(ParserContext parser)
        {
            parser.ValueStackDepth = 0;

            this.FunctionID = parser.GetNextFunctionId();

            for (int i = 0; i < this.DefaultValues.Length; ++i)
            {
                if (this.DefaultValues[i] != null)
                {
                    this.DefaultValues[i] = this.DefaultValues[i].Resolve(parser);
                }
            }

            this.Code = Executable.Resolve(parser, this.Code).ToArray();

            if (this.Code.Length == 0 || !(this.Code[this.Code.Length - 1] is ReturnStatement))
            {
                List <Executable> newCode = new List <Executable>(this.Code);
                newCode.Add(new ReturnStatement(this.FirstToken, null, this));
                this.Code = newCode.ToArray();
            }
        }