Exemplo n.º 1
0
        private void Bind(PythonAst unboundAst)
        {
            Assert.NotNull(unboundAst);

            _currentScope = _globalScope = unboundAst;
            _finallyCount.Add(0);

            // Find all scopes and variables
            unboundAst.Walk(this);

            // Bind
            foreach (ScopeStatement scope in _scopes)
            {
                scope.Bind(this);
            }

            // Finish the globals
            unboundAst.Bind(this);

            // Finish Binding w/ outer most scopes first.
            for (int i = _scopes.Count - 1; i >= 0; i--)
            {
                _scopes[i].FinishBind(this);
            }

            // Finish the globals
            unboundAst.FinishBind(this);

            // Run flow checker
            foreach (ScopeStatement scope in _scopes)
            {
                FlowChecker.Check(scope);
            }
        }
Exemplo n.º 2
0
 public static void Check(ScopeStatement scope)
 {
     if (scope.Variables != null)
     {
         FlowChecker fc = new FlowChecker(scope);
         scope.Walk(fc);
     }
 }
Exemplo n.º 3
0
 public FlowDefiner(FlowChecker fc)
 {
     _fc = fc;
 }
Exemplo n.º 4
0
 public FlowDeleter(FlowChecker fc)
 {
     _fc = fc;
 }
Exemplo n.º 5
0
 public FlowDefiner(FlowChecker fc) {
     _fc = fc;
 }
Exemplo n.º 6
0
 public static void Check(ScopeStatement scope) {
     if (scope.Variables != null) {
         FlowChecker fc = new FlowChecker(scope);
         scope.Walk(fc);
     }
 }
Exemplo n.º 7
0
 public FlowDeleter(FlowChecker fc) {
     _fc = fc;
 }
Exemplo n.º 8
0
 public FlowDeleter(FlowChecker fc)
 {
     this.fc = fc;
 }
Exemplo n.º 9
0
 public FlowDefiner(FlowChecker fc)
 {
     this.fc = fc;
 }
Exemplo n.º 10
0
 public static void Check(ScopeStatement scope)
 {
     FlowChecker fc = new FlowChecker(scope);
     scope.Walk(fc);
 }