forked from VimPlug/jedi
Get finally rid of context.type.
This commit is contained in:
@@ -2,7 +2,6 @@ from jedi.common import unite
|
|||||||
|
|
||||||
|
|
||||||
class Context(object):
|
class Context(object):
|
||||||
type = None # TODO remove
|
|
||||||
api_type = 'instance'
|
api_type = 'instance'
|
||||||
"""
|
"""
|
||||||
Most contexts are just instances of something, therefore make this the
|
Most contexts are just instances of something, therefore make this the
|
||||||
|
|||||||
@@ -237,19 +237,16 @@ def get_global_filters(evaluator, context, until_position, origin_scope):
|
|||||||
Returns all filters in order of priority for name resolution.
|
Returns all filters in order of priority for name resolution.
|
||||||
"""
|
"""
|
||||||
from jedi.evaluate.representation import FunctionExecutionContext
|
from jedi.evaluate.representation import FunctionExecutionContext
|
||||||
in_func = False
|
|
||||||
while context is not None:
|
while context is not None:
|
||||||
if not (context.type == 'classdef' and in_func):
|
# Names in methods cannot be resolved within the class.
|
||||||
# Names in methods cannot be resolved within the class.
|
for filter in context.get_filters(
|
||||||
for filter in context.get_filters(
|
search_global=True,
|
||||||
search_global=True,
|
until_position=until_position,
|
||||||
until_position=until_position,
|
origin_scope=origin_scope):
|
||||||
origin_scope=origin_scope):
|
yield filter
|
||||||
yield filter
|
if isinstance(context, FunctionExecutionContext):
|
||||||
if isinstance(context, FunctionExecutionContext):
|
# The position should be reset if the current scope is a function.
|
||||||
# The position should be reset if the current scope is a function.
|
until_position = None
|
||||||
until_position = None
|
|
||||||
in_func = True
|
|
||||||
|
|
||||||
context = context.parent_context
|
context = context.parent_context
|
||||||
|
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ class FakeDict(_FakeArray):
|
|||||||
|
|
||||||
class MergedArray(_FakeArray):
|
class MergedArray(_FakeArray):
|
||||||
def __init__(self, evaluator, arrays):
|
def __init__(self, evaluator, arrays):
|
||||||
super(MergedArray, self).__init__(evaluator, arrays, arrays[-1].type)
|
super(MergedArray, self).__init__(evaluator, arrays, arrays[-1].array_type)
|
||||||
self._arrays = arrays
|
self._arrays = arrays
|
||||||
|
|
||||||
def py__iter__(self):
|
def py__iter__(self):
|
||||||
@@ -660,7 +660,7 @@ def py__getitem__(evaluator, context, types, trailer):
|
|||||||
# If the index is not clearly defined, we have to get all the
|
# If the index is not clearly defined, we have to get all the
|
||||||
# possiblities.
|
# possiblities.
|
||||||
for typ in list(types):
|
for typ in list(types):
|
||||||
if isinstance(typ, AbstractSequence) and typ.type == 'dict':
|
if isinstance(typ, AbstractSequence) and typ.array_type == 'dict':
|
||||||
types.remove(typ)
|
types.remove(typ)
|
||||||
result |= typ.dict_values()
|
result |= typ.dict_values()
|
||||||
return result | py__iter__types(evaluator, types)
|
return result | py__iter__types(evaluator, types)
|
||||||
@@ -685,11 +685,12 @@ def py__getitem__(evaluator, context, types, trailer):
|
|||||||
|
|
||||||
def check_array_additions(evaluator, array):
|
def check_array_additions(evaluator, array):
|
||||||
""" Just a mapper function for the internal _check_array_additions """
|
""" Just a mapper function for the internal _check_array_additions """
|
||||||
if array.type not in ('list', 'set'):
|
if array.array_type not in ('list', 'set'):
|
||||||
# TODO also check for dict updates
|
# TODO also check for dict updates
|
||||||
return set()
|
return set()
|
||||||
|
|
||||||
is_list = array.type == 'list'
|
return set()
|
||||||
|
is_list = array.array_type == 'list'
|
||||||
try:
|
try:
|
||||||
current_module = array.atom.get_parent_until()
|
current_module = array.atom.get_parent_until()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|||||||
Reference in New Issue
Block a user