Get finally rid of context.type.

This commit is contained in:
Dave Halter committed 2016-11-26 10:32:44 +01:00
1 parent 2161be2dcb
commit c1b7acc9ac
3 files changed
+14 -17

No files matched your search

+9 -12
View File
@@ -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