@@ -24,11 +24,11 @@ class _Decoratable: | |||||
# Make sure the function isn't inherited (unless it's overwritten) | # Make sure the function isn't inherited (unless it's overwritten) | ||||
if name.startswith('_') or (name in libmembers and name not in cls.__dict__): | if name.startswith('_') or (name in libmembers and name not in cls.__dict__): | ||||
continue | continue | ||||
if not callable(cls.__dict__[name]): | |||||
if not callable(value): | |||||
continue | continue | ||||
# Skip if v_args already applied (at the function level) | # Skip if v_args already applied (at the function level) | ||||
if hasattr(cls.__dict__[name], 'vargs_applied'): | |||||
if hasattr(cls.__dict__[name], 'vargs_applied') or hasattr(value, 'vargs_applied'): | |||||
continue | continue | ||||
static = isinstance(cls.__dict__[name], (staticmethod, classmethod)) | static = isinstance(cls.__dict__[name], (staticmethod, classmethod)) | ||||
@@ -166,6 +166,15 @@ class TestTrees(TestCase): | |||||
x = MyTransformer().transform( Tree('hello', [2])) | x = MyTransformer().transform( Tree('hello', [2])) | ||||
self.assertEqual(x, 'hello') | self.assertEqual(x, 'hello') | ||||
def test_inline_static(self): | |||||
@v_args(inline=True) | |||||
class T(Transformer): | |||||
@staticmethod | |||||
def test(a, b): | |||||
return a + b | |||||
x = T().transform(Tree('test', ['a', 'b'])) | |||||
self.assertEqual(x, 'ab') | |||||
def test_vargs_override(self): | def test_vargs_override(self): | ||||
t = Tree('add', [Tree('sub', [Tree('i', ['3']), Tree('f', ['1.1'])]), Tree('i', ['1'])]) | t = Tree('add', [Tree('sub', [Tree('i', ['3']), Tree('f', ['1.1'])]), Tree('i', ['1'])]) | ||||