forked from VimPlug/jedi
fix problems with class method decorators
This commit is contained in:
@@ -328,13 +328,13 @@ class Function(use_metaclass(cache.CachedMetaClass, pr.IsScope)):
|
|||||||
debug.warning('decorator not found: %s on %s' %
|
debug.warning('decorator not found: %s on %s' %
|
||||||
(dec, self.base_func))
|
(dec, self.base_func))
|
||||||
return None
|
return None
|
||||||
if len(dec_results) > 1:
|
decorator = dec_results.pop()
|
||||||
|
if dec_results:
|
||||||
debug.warning('multiple decorators found', self.base_func,
|
debug.warning('multiple decorators found', self.base_func,
|
||||||
dec_results)
|
dec_results)
|
||||||
decorator = dec_results.pop()
|
|
||||||
# Create param array.
|
# Create param array.
|
||||||
old_func = Function(f, is_decorated=True)
|
old_func = Function(f, is_decorated=True)
|
||||||
if instance is not None:
|
if instance is not None and decorator.isinstance(Function):
|
||||||
old_func = InstanceElement(instance, old_func)
|
old_func = InstanceElement(instance, old_func)
|
||||||
instance = None
|
instance = None
|
||||||
|
|
||||||
|
|||||||
@@ -99,9 +99,12 @@ def nothing(a,b,c):
|
|||||||
return a,b,c
|
return a,b,c
|
||||||
|
|
||||||
class MethodDecoratorAsClass():
|
class MethodDecoratorAsClass():
|
||||||
class_var
|
class_var = 3
|
||||||
|
@Decorator
|
||||||
def func_without_self(arg):
|
def func_without_self(arg):
|
||||||
return arg
|
return arg
|
||||||
|
|
||||||
|
@Decorator
|
||||||
def func_with_self(self, arg):
|
def func_with_self(self, arg):
|
||||||
return self.class_var
|
return self.class_var
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user