Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix #19: invalid location for decorated scopes

  • Loading branch information...
commit 54845f8c0ab4c4ba61567159df2e42ea96f08c3b 1 parent 508aae3
@baverman authored
Showing with 22 additions and 1 deletion.
  1. +1 −1  supplement/scope.py
  2. +21 −0 tests/test_scope.py
View
2  supplement/scope.py
@@ -212,7 +212,7 @@ def collect_scope_ranges(root, ranges, toclose, parent=None):
ranges[1].append(lrange)
parent = lrange
- for n in ast.iter_child_nodes(root):
+ for n in root.body if isscope else ast.iter_child_nodes(root):
if toclose:
for r in toclose:
r[1] = n.lineno
View
21 tests/test_scope.py
@@ -130,3 +130,24 @@ class Klass(object):
10: '',
11: 'Klass',
}, False)
+
+def test_scope_with_decorators(project):
+ source = cleantabs("""
+ @decorator
+ class Cls(object):
+ def m1(self):
+ pass
+
+ @staticmethod
+ def m2():
+ pass
+ """)
+
+ check_scope(project, source, {
+ 1: 'Cls',
+ 2: 'Cls',
+ 3: 'Cls.m1',
+ 5: 'Cls.m1',
+ 6: 'Cls.m2',
+ 7: 'Cls.m2',
+ }, True)
Please sign in to comment.
Something went wrong with that request. Please try again.