diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 20262d92..9bbfd1ac 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -1066,13 +1066,17 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False, if is_execution(a): return True elif a.isinstance(parsing.Call): - if a.name == name and a.execution: + # Compare start_pos, because names may be different + # because of executions. + if a.name.start_pos == name.start_pos \ + and a.execution: return True return False is_exe = False for op, assignee in par.assignment_details: is_exe |= is_execution(assignee) + if is_exe: # filter array[3] = ... # TODO check executions for dict contents diff --git a/jedi/parsing.py b/jedi/parsing.py index 0a41c830..ab93c123 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -766,8 +766,7 @@ class Statement(Simple): self._assignment_details.append((tok, top)) # All these calls wouldn't be important if nonlocal would # exist. -> Initialize the first item again. - result = Array(start_pos, Array.NOARRAY, self) - top = result + top = result = Array(start_pos, Array.NOARRAY, self) level = 0 close_brackets = False is_chain = False @@ -776,6 +775,7 @@ class Statement(Simple): next(tok_iter, None) continue + # here starts the statement creation madness! brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET} is_call = lambda: type(result) == Call is_call_or_close = lambda: is_call() or close_brackets diff --git a/test/completion/arrays.py b/test/completion/arrays.py index e8f15e61..fbae3480 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -163,6 +163,7 @@ dic2[r'asdf'] dic2['just_something'] def f(): + """ github #83 """ r = {} r['status'] = (200, 'ok') return r