mirror of
https://github.com/davidhalter/jedi.git
synced 2026-11-13 22:42:57 +08:00
Get finally rid of context.type.
This commit is contained in:
1 parent
2161be2dcb
commit
c1b7acc9ac
3 files changed
+14
-17
No files matched your search
@@ -237,19 +237,16 @@ def get_global_filters(evaluator, context, until_position, origin_scope):
|
||||
Returns all filters in order of priority for name resolution.
|
||||
"""
|
||||
from jedi.evaluate.representation import FunctionExecutionContext
|
||||
in_func = False
|
||||
while context is not None:
|
||||
if not (context.type == 'classdef' and in_func):
|
||||
# Names in methods cannot be resolved within the class.
|
||||
for filter in context.get_filters(
|
||||
search_global=True,
|
||||
until_position=until_position,
|
||||
origin_scope=origin_scope):
|
||||
yield filter
|
||||
if isinstance(context, FunctionExecutionContext):
|
||||
# The position should be reset if the current scope is a function.
|
||||
until_position = None
|
||||
in_func = True
|
||||
# Names in methods cannot be resolved within the class.
|
||||
for filter in context.get_filters(
|
||||
search_global=True,
|
||||
until_position=until_position,
|
||||
origin_scope=origin_scope):
|
||||
yield filter
|
||||
if isinstance(context, FunctionExecutionContext):
|
||||
# The position should be reset if the current scope is a function.
|
||||
until_position = None
|
||||
|
||||
context = context.parent_context
|
||||
|
||||
|
||||
Reference in new issue
Block a user