forked from VimPlug/jedi
Trying to change used_names, so that they don't contain name definitions from CompFor.
This commit is contained in:
@@ -136,8 +136,8 @@ class Evaluator(object):
|
||||
if seek_name:
|
||||
types = finder.check_tuple_assignments(types, seek_name)
|
||||
|
||||
ass_details = stmt.assignment_details
|
||||
if ass_details and ass_details[0][1] != '=' and not isinstance(stmt, er.InstanceElement): # TODO don't check for this.
|
||||
#ass_details = stmt.assignment_details
|
||||
if False and stmt.assignment_details and ass_details[0][1] != '=' and not isinstance(stmt, er.InstanceElement): # TODO don't check for this.
|
||||
expr_list, _operator = ass_details[0]
|
||||
# `=` is always the last character in aug assignments -> -1
|
||||
operator = copy.copy(_operator)
|
||||
@@ -156,7 +156,7 @@ class Evaluator(object):
|
||||
result = left
|
||||
else:
|
||||
result = precedence.calculate(self, left, operator, result)
|
||||
elif len(stmt.get_defined_names()) > 1 and seek_name and ass_details:
|
||||
elif False and len(stmt.get_defined_names()) > 1 and seek_name and ass_details:
|
||||
# Assignment checking is only important if the statement defines
|
||||
# multiple variables.
|
||||
new_result = []
|
||||
@@ -201,8 +201,8 @@ class Evaluator(object):
|
||||
if isinstance(atom, pr.Name):
|
||||
# This is the first global lookup.
|
||||
stmt = atom.get_definition()
|
||||
return self.find_types(stmt.get_parent_until(pr.IsScope), atom,
|
||||
stmt.start_pos, search_global=True)
|
||||
scope = stmt.get_parent_until(pr.IsScope, include_current=True)
|
||||
return self.find_types(scope, atom, stmt.start_pos, search_global=True)
|
||||
elif isinstance(atom, pr.Literal):
|
||||
return [compiled.create(self, atom.eval())]
|
||||
else:
|
||||
|
||||
@@ -74,8 +74,8 @@ class NameFinder(object):
|
||||
except KeyError:
|
||||
return []
|
||||
|
||||
names = [name for name in names if name.is_definition()]
|
||||
names = pr.filter_after_position(names, position)
|
||||
names = [name for name in names if name.is_definition()]
|
||||
|
||||
# Only the names defined in the last position are valid definitions.
|
||||
last_names = []
|
||||
@@ -287,12 +287,8 @@ class NameFinder(object):
|
||||
types += check_tuple_assignments(for_types, name)
|
||||
elif isinstance(typ, pr.Param):
|
||||
types += self._eval_param(typ)
|
||||
elif typ.isinstance(pr.ExprStmt):
|
||||
if typ.is_global():
|
||||
# global keyword handling.
|
||||
types += evaluator.find_types(typ.parent.parent, str(name))
|
||||
else:
|
||||
types += self._remove_statements(typ, name)
|
||||
elif typ.isinstance(pr.ExprStmt, pr.CompFor):
|
||||
types += self._remove_statements(typ, name)
|
||||
elif isinstance(typ, pr.Import):
|
||||
types += imports.ImportWrapper(self._evaluator, name).follow()
|
||||
else:
|
||||
|
||||
@@ -222,7 +222,7 @@ class Array(IterableWrapper):
|
||||
if array_node in (']', '}', ')'):
|
||||
return [] # Direct closing bracket, doesn't contain items.
|
||||
|
||||
if pr.is_node(array_node, 'testlist_comp', 'testlist_star_expr', 'testlist'):
|
||||
if pr.is_node(array_node, 'testlist_comp'):
|
||||
return array_node.children[::2]
|
||||
elif pr.is_node(array_node, 'dictorsetmaker'):
|
||||
kv = []
|
||||
|
||||
Reference in New Issue
Block a user