IronRuby.Compiler.Ast.AstGenerator.EnterFileInitializer C# (CSharp) Method

EnterFileInitializer() public method

public EnterFileInitializer ( ScopeBuilder locals, System.Linq.Expressions selfVariable, System.Linq.Expressions runtimeScopeVariable ) : void
locals ScopeBuilder
selfVariable System.Linq.Expressions
runtimeScopeVariable System.Linq.Expressions
return void
        public void EnterFileInitializer(
            ScopeBuilder/*!*/ locals,
            MSA.Expression/*!*/ selfVariable,
            MSA.ParameterExpression/*!*/ runtimeScopeVariable) {

            VariableScope scope = new VariableScope(locals, selfVariable, runtimeScopeVariable);

            scope.Parent = _currentElement;
            scope.ParentVariableScope = _currentVariableScope;

            _currentElement = scope;
            _currentVariableScope = scope;
        }

Usage Example

Example #1
0
        private void TransformBody(AstGenerator /*!*/ gen)
        {
            ScopeBuilder scope = DefineLocals();

            var scopeVariable = gen.TopLevelScope.Builder.DefineHiddenVariable("#scope", typeof(RubyScope));

            gen.EnterFileInitializer(
                scope,
                gen.TopLevelScope.SelfVariable,
                scopeVariable
                );

            // visit nested initializers depth-first:
            var body = gen.TransformStatements(_statements, ResultOperation.Ignore);

            gen.LeaveFileInitializer();

            gen.AddFileInitializer(
                scope.CreateScope(
                    scopeVariable,
                    Methods.CreateFileInitializerScope.OpCall(
                        scope.MakeLocalsStorage(),
                        scope.GetVariableNamesExpression(),
                        gen.TopLevelScope.RuntimeScopeVariable
                        ),
                    body
                    )
                );
        }
All Usage Examples Of IronRuby.Compiler.Ast.AstGenerator::EnterFileInitializer