mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
fixed an ordering bug (without test)
This commit is contained in:
14
evaluate.py
14
evaluate.py
@@ -164,7 +164,7 @@ class Instance(Executable):
|
|||||||
self_name = self.get_func_self_name(sub)
|
self_name = self.get_func_self_name(sub)
|
||||||
if self_name:
|
if self_name:
|
||||||
# Check the __init__ function.
|
# Check the __init__ function.
|
||||||
if self.var_args and sub.name.get_code() == '__init__':
|
if sub.name.get_code() == '__init__':
|
||||||
sub = self.get_init_execution(sub)
|
sub = self.get_init_execution(sub)
|
||||||
for n in sub.get_set_vars():
|
for n in sub.get_set_vars():
|
||||||
# Only names with the selfname are being added.
|
# Only names with the selfname are being added.
|
||||||
@@ -232,7 +232,7 @@ class InstanceElement(object):
|
|||||||
@memoize_default()
|
@memoize_default()
|
||||||
def parent(self):
|
def parent(self):
|
||||||
par = self.var.parent
|
par = self.var.parent
|
||||||
if not isinstance(par, parsing.Module):
|
if not isinstance(par, (parsing.Module, Class)):
|
||||||
par = InstanceElement(self.instance, par)
|
par = InstanceElement(self.instance, par)
|
||||||
return par
|
return par
|
||||||
|
|
||||||
@@ -535,8 +535,14 @@ class Execution(Executable):
|
|||||||
if value:
|
if value:
|
||||||
values = [value]
|
values = [value]
|
||||||
else:
|
else:
|
||||||
|
if param.assignment_details:
|
||||||
# No value: return the default values.
|
# No value: return the default values.
|
||||||
values = assignments
|
values = assignments
|
||||||
|
else:
|
||||||
|
# If there is no assignment detail, that means there is
|
||||||
|
# no assignment, just the result. Therefore nothing has
|
||||||
|
# to be returned.
|
||||||
|
values = []
|
||||||
|
|
||||||
# Just ignore all the params that are without a key, after one
|
# Just ignore all the params that are without a key, after one
|
||||||
# keyword argument was set.
|
# keyword argument was set.
|
||||||
@@ -929,8 +935,12 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False):
|
|||||||
# here is the position stuff happening (sorting of variables)
|
# here is the position stuff happening (sorting of variables)
|
||||||
for name in sorted(name_list, key=comparison_func, reverse=True):
|
for name in sorted(name_list, key=comparison_func, reverse=True):
|
||||||
p = name.parent.parent if name.parent else None
|
p = name.parent.parent if name.parent else None
|
||||||
|
if isinstance(p, InstanceElement) \
|
||||||
|
and isinstance(p.var, parsing.Class):
|
||||||
|
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.
|
||||||
|
|||||||
@@ -276,9 +276,10 @@ class PropClass():
|
|||||||
@property
|
@property
|
||||||
def ret(self):
|
def ret(self):
|
||||||
return self.a
|
return self.a
|
||||||
#@ret.setter
|
|
||||||
#def ret(self, value):
|
@ret.setter
|
||||||
#return 1.0
|
def ret(self, value):
|
||||||
|
return 1.0
|
||||||
|
|
||||||
def ret2(self):
|
def ret2(self):
|
||||||
return self.a
|
return self.a
|
||||||
@@ -296,8 +297,8 @@ PropClass().ret.
|
|||||||
|
|
||||||
#? str()
|
#? str()
|
||||||
PropClass("").ret2
|
PropClass("").ret2
|
||||||
#? str()
|
#?
|
||||||
PropClass().ret2.
|
PropClass().ret2
|
||||||
|
|
||||||
#? int()
|
#? int()
|
||||||
PropClass(1).nested
|
PropClass(1).nested
|
||||||
|
|||||||
Reference in New Issue
Block a user