mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 15:24:46 +08:00
dicts are now returned correctly, just without content
This commit is contained in:
28
evaluate.py
28
evaluate.py
@@ -984,6 +984,26 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
|||||||
inst = Instance(Class(par.parent().parent()))
|
inst = Instance(Class(par.parent().parent()))
|
||||||
inst.is_generated = True
|
inst.is_generated = True
|
||||||
result.append(inst)
|
result.append(inst)
|
||||||
|
elif isinstance(par, parsing.Statement):
|
||||||
|
def is_execution(arr):
|
||||||
|
for a in arr:
|
||||||
|
a = a[0] # rest is always empty with assignees
|
||||||
|
if isinstance(a, parsing.Array):
|
||||||
|
if is_execution(a):
|
||||||
|
return True
|
||||||
|
elif isinstance(a, parsing.Call):
|
||||||
|
if a.name == name 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:
|
||||||
|
# TODO: check executions for dict contents
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
result.append(par)
|
||||||
else:
|
else:
|
||||||
result.append(par)
|
result.append(par)
|
||||||
return result
|
return result
|
||||||
@@ -1001,14 +1021,14 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
|||||||
p = p.var
|
p = p.var
|
||||||
if name_str == name.get_code() and p not in break_scopes:
|
if name_str == name.get_code() and p not in break_scopes:
|
||||||
result += handle_non_arrays(name)
|
result += handle_non_arrays(name)
|
||||||
#print result, p
|
|
||||||
# for comparison we need the raw class
|
# for comparison we need the raw class
|
||||||
s = scope.base if isinstance(scope, Class) else scope
|
s = scope.base if isinstance(scope, Class) else scope
|
||||||
# this means that a definition was found and is not e.g.
|
# this means that a definition was found and is not e.g.
|
||||||
# in if/else.
|
# in if/else.
|
||||||
if not name.parent() or p == s:
|
if result:
|
||||||
break
|
if not name.parent() or p == s:
|
||||||
break_scopes.append(p)
|
break
|
||||||
|
break_scopes.append(p)
|
||||||
# if there are results, ignore the other scopes
|
# if there are results, ignore the other scopes
|
||||||
if result:
|
if result:
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in New Issue
Block a user