mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
on import completion preparations.
This commit is contained in:
@@ -104,6 +104,7 @@ class Parser(object):
|
||||
# and only if the refactor method's write parameter was True.
|
||||
self.used_names = {}
|
||||
self.scope_names_stack = [{}]
|
||||
self.failed_statement_stacks = []
|
||||
logger = logging.getLogger("Jedi-Parser")
|
||||
d = pgen2.Driver(grammar, self.convert_node,
|
||||
self.convert_leaf, self.error_recovery, logger=logger)
|
||||
@@ -189,11 +190,10 @@ class Parser(object):
|
||||
if symbol in ('file_input', 'suite'):
|
||||
index = i
|
||||
break
|
||||
self._stack_removal(stack, index + 1)
|
||||
# No success finding a transition
|
||||
#raise ParseError("bad input", type, value, context)
|
||||
self._stack_removal(grammar, stack, index + 1)
|
||||
|
||||
def _stack_removal(self, stack, start_index):
|
||||
def _stack_removal(self, grammar, stack, start_index):
|
||||
def clear_names(children):
|
||||
for c in children:
|
||||
try:
|
||||
@@ -206,6 +206,16 @@ class Parser(object):
|
||||
except ValueError:
|
||||
pass # This may happen with CompFor.
|
||||
|
||||
failed_stack = []
|
||||
found = False
|
||||
for dfa, state, (typ, nodes) in stack[start_index:]:
|
||||
if nodes:
|
||||
found = True
|
||||
if found:
|
||||
symbol = grammar.number2symbol[typ]
|
||||
failed_stack.append((symbol, nodes))
|
||||
self.failed_statement_stacks.append(failed_stack)
|
||||
|
||||
for dfa, state, node in stack[start_index:]:
|
||||
clear_names(children=node[1])
|
||||
|
||||
|
||||
@@ -228,8 +228,7 @@ from import_tree import recurse_class1
|
||||
#? ['a']
|
||||
recurse_class1.C.a
|
||||
# github #239 RecursionError
|
||||
# TODO UNCOMMENT!!!!!!
|
||||
##? ['a']
|
||||
#? ['a']
|
||||
recurse_class1.C().a
|
||||
|
||||
# -----------------
|
||||
|
||||
@@ -4,6 +4,11 @@ def from_names():
|
||||
#? ['path']
|
||||
from os.
|
||||
|
||||
def from_names_goto():
|
||||
from import_tree import pkg
|
||||
#? pkg
|
||||
from import_tree.pkg
|
||||
|
||||
def builtin_test():
|
||||
#? ['math']
|
||||
import math
|
||||
|
||||
Reference in New Issue
Block a user