1
0
forked from VimPlug/jedi

Most integration tests (except 2) pass if we don't always make the use of an ExprStmt.

This commit is contained in:
Dave Halter
2015-03-05 01:55:25 +01:00
parent 5d54922c4b
commit b489019f5b
4 changed files with 29 additions and 26 deletions

View File

@@ -205,6 +205,10 @@ class Evaluator(object):
scope = stmt.get_parent_until(pr.IsScope, include_current=True)
if isinstance(stmt, pr.CompFor):
stmt = stmt.get_parent_until((pr.ClassOrFunc, pr.ExprStmt))
if stmt.type != 'expr_stmt':
# We only need to adjust the start_pos for statements, because
# there the name cannot be used.
stmt = atom
return self.find_types(scope, atom, stmt.start_pos, search_global=True)
elif isinstance(atom, pr.Literal):
return [compiled.create(self, atom.eval())]
@@ -347,5 +351,9 @@ class Evaluator(object):
self.find_types(typ, name, is_goto=True) for typ in types
))
else:
if stmt.type != 'expr_stmt':
# We only need to adjust the start_pos for statements, because
# there the name cannot be used.
stmt = name
return self.find_types(scope, name, stmt.start_pos,
search_global=True, is_goto=True)

View File

@@ -153,7 +153,7 @@ def _execute_types_in_stmt(evaluator, stmt):
doesn't include tuple, list and dict literals, because the stuff they
contain is executed. (Used as type information).
"""
definitions = evaluator.eval_statement(stmt)
definitions = evaluator.eval_element(stmt)
return chain.from_iterable(_execute_array_values(evaluator, d) for d in definitions)