Rename value -> context for some more places

This commit is contained in:
Dave Halter
2019-08-24 02:36:29 +02:00
parent e148d5120f
commit ce3ec4eecb
2 changed files with 8 additions and 8 deletions

View File

@@ -28,11 +28,11 @@ from jedi.parser_utils import is_scope, get_parent_scope
class NameFinder(object): class NameFinder(object):
def __init__(self, context, name_value, name_or_str, def __init__(self, context, name_context, name_or_str,
position=None, analysis_errors=True): position=None, analysis_errors=True):
# Make sure that it's not just a syntax tree node. # Make sure that it's not just a syntax tree node.
self._context = context self._context = context
self._name_context = name_value self._name_context = name_context
self._name = name_or_str self._name = name_or_str
if isinstance(name_or_str, tree.Name): if isinstance(name_or_str, tree.Name):
self._string_name = name_or_str.value self._string_name = name_or_str.value

View File

@@ -150,7 +150,7 @@ def comprehension_from_atom(inference_state, value, atom):
class ComprehensionMixin(object): class ComprehensionMixin(object):
@inference_state_method_cache() @inference_state_method_cache()
def _get_comp_for_value(self, parent_context, comp_for): def _get_comp_for_context(self, parent_context, comp_for):
return CompForContext(parent_context, comp_for) return CompForContext(parent_context, comp_for)
def _nested(self, comp_fors, parent_context=None): def _nested(self, comp_fors, parent_context=None):
@@ -169,18 +169,18 @@ class ComprehensionMixin(object):
for i, lazy_value in enumerate(iterated): for i, lazy_value in enumerate(iterated):
types = lazy_value.infer() types = lazy_value.infer()
dct = unpack_tuple_to_dict(parent_context, types, exprlist) dct = unpack_tuple_to_dict(parent_context, types, exprlist)
value_ = self._get_comp_for_value( context = self._get_comp_for_context(
parent_context, parent_context,
comp_for, comp_for,
) )
with predefine_names(value_, comp_for, dct): with predefine_names(context, comp_for, dct):
try: try:
for result in self._nested(comp_fors[1:], value_): for result in self._nested(comp_fors[1:], context):
yield result yield result
except IndexError: except IndexError:
iterated = value_.infer_node(self._entry_node) iterated = context.infer_node(self._entry_node)
if self.array_type == 'dict': if self.array_type == 'dict':
yield iterated, value_.infer_node(self._value_node) yield iterated, context.infer_node(self._value_node)
else: else:
yield iterated yield iterated