mirror of
https://github.com/davidhalter/jedi.git
synced 2026-05-25 17:58:35 +08:00
parts of code were executed even though they weren't required, related to #47
This commit is contained in:
+10
-7
@@ -1010,18 +1010,21 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False,
|
|||||||
add = get_scopes_for_name(r.parent(),
|
add = get_scopes_for_name(r.parent(),
|
||||||
str(token_name))
|
str(token_name))
|
||||||
else:
|
else:
|
||||||
# generated objects are used within executions, where
|
# generated objects are used within executions, but these
|
||||||
|
# objects are in functions, and we have to dynamically
|
||||||
|
# execute first.
|
||||||
if isinstance(r, parsing.Param):
|
if isinstance(r, parsing.Param):
|
||||||
func = r.parent()
|
func = r.parent()
|
||||||
# Instances are typically faked, if the instance is not
|
if not r.is_generated:
|
||||||
# called from outside. Here we check it for __init__
|
# Instances are typically faked, if the instance is
|
||||||
# functions and return.
|
# not called from outside. Here we check it for
|
||||||
if isinstance(func, InstanceElement) \
|
# __init__ functions and return.
|
||||||
|
if isinstance(func, InstanceElement) \
|
||||||
and func.instance.is_generated \
|
and func.instance.is_generated \
|
||||||
and str(func.name) == '__init__' \
|
and str(func.name) == '__init__' \
|
||||||
and r.position_nr > 0: # 0 would be self
|
and r.position_nr > 0: # 0 would be self
|
||||||
r = func.var.params[r.position_nr]
|
r = func.var.params[r.position_nr]
|
||||||
if not r.is_generated:
|
|
||||||
res_new += dynamic.search_params(r)
|
res_new += dynamic.search_params(r)
|
||||||
if not r.assignment_details:
|
if not r.assignment_details:
|
||||||
# this means that there are no default params,
|
# this means that there are no default params,
|
||||||
|
|||||||
Reference in New Issue
Block a user