예제 #1
0
        internal override void Resolve(Parser 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);
                }

                TODO.RemoveAnnotationsFromParser();

                // Annotations not allowed in byte code mode
                if (this.ArgAnnotations[i] != null)
                {
                    throw new ParserException(this.ArgAnnotations[i].FirstToken, "Unexpected token: '@'");
                }
            }

            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();
            }
        }
예제 #2
0
        internal override IList <Executable> Resolve(Parser 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));
        }