mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
decorators should also be included in the static analysis
This commit is contained in:
@@ -138,4 +138,11 @@ def get_module_statements(module):
|
||||
imports |= set(scope.imports)
|
||||
stmts |= add_stmts(scope.statements)
|
||||
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
|
||||
|
||||
@@ -75,3 +75,12 @@ return_one(''.undefined_attribute)
|
||||
[undefined for r in [1, 2]]
|
||||
|
||||
[r for r in [1, 2]]
|
||||
|
||||
# -----------------
|
||||
# decorators
|
||||
# -----------------
|
||||
|
||||
#! 1 name-error
|
||||
@undefined_decorator
|
||||
def func():
|
||||
return 1
|
||||
|
||||
Reference in New Issue
Block a user