Example #1
0
        // This is called at the end of the TopLevelEntity's allocation phase and allocates
        // ID's to the lambda's code.
        internal void ResolveVariableOriginsForInnerCode(ParserContext parser, VariableScope scopeFromParent)
        {
            this.VariableScope = VariableScope.CreateClosure(scopeFromParent);
            List <VariableId> argVarIds = new List <VariableId>();

            for (int i = 0; i < this.Args.Length; ++i)
            {
                if (this.Args[i].Value == "xxxx")
                {
                }
                VariableId varId = this.VariableScope.RegisterVariableForcedReDeclaration(
                    this.ArgTypes[i],
                    this.Args[i].Value,
                    this.Args[i]);
                argVarIds.Add(varId);
            }
            this.ArgVarIds = argVarIds.ToArray();

            foreach (Executable ex in this.Code)
            {
                ex.ResolveVariableOrigins(parser, this.VariableScope, VariableIdAllocPhase.REGISTER_AND_ALLOC);
            }

            this.VariableScope.FinalizeScopeIds();

            foreach (Lambda lambda in this.Lambdas)
            {
                lambda.ResolveVariableOriginsForInnerCode(parser, this.VariableScope);
            }
        }