Пример #1
0
        private void Bind(PythonAst unboundAst)
        {
            _currentScope = GlobalScope = unboundAst;
            _finallyCount.Add(0);

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

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

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

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

            // Finish the globals
            unboundAst.FinishBind(this);
        }
        internal static void Check(PythonAst ast, PythonLanguageVersion langVersion, Action <int, int, string> reportError)
        {
            if (langVersion < PythonLanguageVersion.V38)
            {
                return;
            }

            ast.Walk(new NamedExpressionErrorWalker(reportError));
        }