decorators should also be included in the static analysis

This commit is contained in:
Dave Halter
2014-05-16 15:33:21 +02:00
parent 0f7a17090c
commit 11b7f9f7f6
2 changed files with 16 additions and 0 deletions

View File

@@ -138,4 +138,11 @@ def get_module_statements(module):
imports |= set(scope.imports) imports |= set(scope.imports)
stmts |= add_stmts(scope.statements) stmts |= add_stmts(scope.statements)
stmts |= add_stmts(r for r in scope.returns if r is not None) stmts |= add_stmts(r for r in scope.returns if r is not None)
try:
decorators = scope.decorators
except AttributeError:
pass
else:
stmts |= add_stmts(decorators)
return stmts, imports return stmts, imports

View File

@@ -75,3 +75,12 @@ return_one(''.undefined_attribute)
[undefined for r in [1, 2]] [undefined for r in [1, 2]]
[r for r in [1, 2]] [r for r in [1, 2]]
# -----------------
# decorators
# -----------------
#! 1 name-error
@undefined_decorator
def func():
return 1