Exemplo n.º 1
0
        private PythonAst CreateAst(Statement ret) {
            var ast = new PythonAst(ret, _tokenizer.GetLineLocations(), _tokenizer.LanguageVersion);
            ast.HasVerbatim = _verbatim;
            ast.PrivatePrefix = _privatePrefix;
            if (_token.Token != null) {
                ast.SetLoc(0, GetEnd());
            }
            if (_verbatim) {
                AddExtraVerbatimText(ast, _lookaheadWhiteSpace + _lookahead.Token.VerbatimImage);
            }
            foreach (var keyValue in _attributes) {
                foreach (var nodeAttr in keyValue.Value) {
                    ast.SetAttribute(keyValue.Key, nodeAttr.Key, nodeAttr.Value);
                }
            }
            
            PythonNameBinder.BindAst(_langVersion, ast, _errors, _bindReferences);

            return ast;
        }