forked from VimPlug/jedi
no confusions in executions for dict assignments, fixes #83
This commit is contained in:
@@ -1066,13 +1066,17 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
|||||||
if is_execution(a):
|
if is_execution(a):
|
||||||
return True
|
return True
|
||||||
elif a.isinstance(parsing.Call):
|
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 True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
is_exe = False
|
is_exe = False
|
||||||
for op, assignee in par.assignment_details:
|
for op, assignee in par.assignment_details:
|
||||||
is_exe |= is_execution(assignee)
|
is_exe |= is_execution(assignee)
|
||||||
|
|
||||||
if is_exe:
|
if is_exe:
|
||||||
# filter array[3] = ...
|
# filter array[3] = ...
|
||||||
# TODO check executions for dict contents
|
# TODO check executions for dict contents
|
||||||
|
|||||||
@@ -766,8 +766,7 @@ class Statement(Simple):
|
|||||||
self._assignment_details.append((tok, top))
|
self._assignment_details.append((tok, top))
|
||||||
# All these calls wouldn't be important if nonlocal would
|
# All these calls wouldn't be important if nonlocal would
|
||||||
# exist. -> Initialize the first item again.
|
# exist. -> Initialize the first item again.
|
||||||
result = Array(start_pos, Array.NOARRAY, self)
|
top = result = Array(start_pos, Array.NOARRAY, self)
|
||||||
top = result
|
|
||||||
level = 0
|
level = 0
|
||||||
close_brackets = False
|
close_brackets = False
|
||||||
is_chain = False
|
is_chain = False
|
||||||
@@ -776,6 +775,7 @@ class Statement(Simple):
|
|||||||
next(tok_iter, None)
|
next(tok_iter, None)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# here starts the statement creation madness!
|
||||||
brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET}
|
brackets = {'(': Array.TUPLE, '[': Array.LIST, '{': Array.SET}
|
||||||
is_call = lambda: type(result) == Call
|
is_call = lambda: type(result) == Call
|
||||||
is_call_or_close = lambda: is_call() or close_brackets
|
is_call_or_close = lambda: is_call() or close_brackets
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ dic2[r'asdf']
|
|||||||
dic2['just_something']
|
dic2['just_something']
|
||||||
|
|
||||||
def f():
|
def f():
|
||||||
|
""" github #83 """
|
||||||
r = {}
|
r = {}
|
||||||
r['status'] = (200, 'ok')
|
r['status'] = (200, 'ok')
|
||||||
return r
|
return r
|
||||||
|
|||||||
Reference in New Issue
Block a user