forked from VimPlug/jedi
Actual forward reference annotations are working pretty smooth now.
This commit is contained in:
@@ -305,6 +305,8 @@ class Evaluator(object):
|
||||
types = set(chain.from_iterable(self.find_types(typ, next_name)
|
||||
for typ in types))
|
||||
types = types
|
||||
elif element.type == 'eval_input':
|
||||
types = self._eval_element_not_cached(element.children[0])
|
||||
else:
|
||||
types = precedence.calculate_children(self, element.children)
|
||||
debug.dbg('eval_element result %s', types)
|
||||
|
||||
@@ -32,7 +32,7 @@ def _evaluate_for_annotation(evaluator, annotation):
|
||||
for definition in evaluator.eval_element(annotation):
|
||||
if (isinstance(definition, CompiledObject) and
|
||||
isinstance(definition.obj, str)):
|
||||
p = Parser(load_grammar(), definition.obj, start='expr')
|
||||
p = Parser(load_grammar(), definition.obj, start='eval_input')
|
||||
element = p.get_parsed_node()
|
||||
if element is None:
|
||||
debug.warning('Annotation not parsed: %s' % definition.obj)
|
||||
|
||||
@@ -14,7 +14,7 @@ from jedi.common import unite
|
||||
from jedi.evaluate import compiled
|
||||
from jedi.evaluate import representation as er
|
||||
from jedi.evaluate import iterable
|
||||
from jedi.parser import Parser
|
||||
from jedi.parser import ParserWithRecovery
|
||||
from jedi.parser import tree
|
||||
from jedi import debug
|
||||
from jedi.evaluate import precedence
|
||||
@@ -243,7 +243,7 @@ def collections_namedtuple(evaluator, obj, arguments):
|
||||
)
|
||||
|
||||
# Parse source
|
||||
generated_class = Parser(evaluator.grammar, unicode(source)).module.subscopes[0]
|
||||
generated_class = ParserWithRecovery(evaluator.grammar, unicode(source)).module.subscopes[0]
|
||||
return set([er.Class(evaluator, generated_class)])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user