mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
again a decorator fix, which is important for nested decorators
This commit is contained in:
11
evaluate.py
11
evaluate.py
@@ -283,8 +283,9 @@ class Function(object):
|
|||||||
debug.dbg('decorator:', dec, f)
|
debug.dbg('decorator:', dec, f)
|
||||||
dec_results = follow_statement(dec)
|
dec_results = follow_statement(dec)
|
||||||
if not len(dec_results):
|
if not len(dec_results):
|
||||||
debug.warning('decorator func not found', self.base_func)
|
debug.warning('decorator func not found: %s in stmt %s' %
|
||||||
return []
|
(self.base_func, dec))
|
||||||
|
return None
|
||||||
if len(dec_results) > 1:
|
if len(dec_results) > 1:
|
||||||
debug.warning('multiple decorators found', self.base_func,
|
debug.warning('multiple decorators found', self.base_func,
|
||||||
dec_results)
|
dec_results)
|
||||||
@@ -296,7 +297,7 @@ class Function(object):
|
|||||||
wrappers = Execution(decorator, params).get_return_types()
|
wrappers = Execution(decorator, params).get_return_types()
|
||||||
if not len(wrappers):
|
if not len(wrappers):
|
||||||
debug.warning('no wrappers found', self.base_func)
|
debug.warning('no wrappers found', self.base_func)
|
||||||
return []
|
return None
|
||||||
if len(wrappers) > 1:
|
if len(wrappers) > 1:
|
||||||
debug.warning('multiple wrappers found', self.base_func,
|
debug.warning('multiple wrappers found', self.base_func,
|
||||||
wrappers)
|
wrappers)
|
||||||
@@ -1065,9 +1066,11 @@ def follow_path(path, scope, position=None):
|
|||||||
# curly braces are not allowed, because they make no sense
|
# curly braces are not allowed, because they make no sense
|
||||||
debug.warning('strange function call with {}', current, scope)
|
debug.warning('strange function call with {}', current, scope)
|
||||||
else:
|
else:
|
||||||
if isinstance(scope, Function):
|
# the function must not be decorated with something else
|
||||||
|
if isinstance(scope, Function) and isinstance(scope.func, Function):
|
||||||
# TODO check default function methods and return them
|
# TODO check default function methods and return them
|
||||||
result = []
|
result = []
|
||||||
|
print 'la'
|
||||||
else:
|
else:
|
||||||
# TODO check magic class methods and return them also
|
# TODO check magic class methods and return them also
|
||||||
# this is the typical lookup while chaining things
|
# this is the typical lookup while chaining things
|
||||||
|
|||||||
@@ -183,9 +183,9 @@ class B():
|
|||||||
def r(self):
|
def r(self):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
#@r.setter
|
@r.setter
|
||||||
#def r(self, value):
|
def r(self, value):
|
||||||
# pass
|
pass
|
||||||
|
|
||||||
#? []
|
#? []
|
||||||
B().r.
|
B().r.
|
||||||
|
|||||||
Reference in New Issue
Block a user