forked from VimPlug/jedi
expression_list instead of commands in more places
This commit is contained in:
@@ -312,9 +312,9 @@ class Evaluator(object):
|
||||
return []
|
||||
result = get_iterator_types(self.eval_statement(loop.inputs[0]))
|
||||
if len(loop.set_vars) > 1:
|
||||
commands = loop.set_stmt.expression_list()
|
||||
expression_list = loop.set_stmt.expression_list()
|
||||
# loops with loop.set_vars > 0 only have one command
|
||||
result = assign_tuples(commands[0], result, name_str)
|
||||
result = assign_tuples(expression_list[0], result, name_str)
|
||||
return result
|
||||
|
||||
def process(name):
|
||||
@@ -497,8 +497,8 @@ class Evaluator(object):
|
||||
# variables.
|
||||
if len(stmt.get_set_vars()) > 1 and seek_name and stmt.assignment_details:
|
||||
new_result = []
|
||||
for ass_commands, op in stmt.assignment_details:
|
||||
new_result += find_assignments(ass_commands[0], result, seek_name)
|
||||
for ass_expression_list, op in stmt.assignment_details:
|
||||
new_result += find_assignments(ass_expression_list[0], result, seek_name)
|
||||
result = new_result
|
||||
return set(result)
|
||||
|
||||
@@ -669,12 +669,12 @@ class Evaluator(object):
|
||||
|
||||
def goto(self, stmt, call_path=None):
|
||||
if call_path is None:
|
||||
commands = stmt.expression_list()
|
||||
if len(commands) == 0:
|
||||
expression_list = stmt.expression_list()
|
||||
if len(expression_list) == 0:
|
||||
return [], ''
|
||||
# Only the first command is important, the rest should basically not
|
||||
# happen except in broken code (e.g. docstrings that aren't code).
|
||||
call = commands[0]
|
||||
call = expression_list[0]
|
||||
if isinstance(call, (str, unicode)):
|
||||
call_path = [call]
|
||||
else:
|
||||
|
||||
@@ -209,11 +209,11 @@ def search_params(evaluator, param):
|
||||
# get the param name
|
||||
if param.assignment_details:
|
||||
# first assignment details, others would be a syntax error
|
||||
commands, op = param.assignment_details[0]
|
||||
expression_list, op = param.assignment_details[0]
|
||||
else:
|
||||
commands = param.expression_list()
|
||||
offset = 1 if commands[0] in ['*', '**'] else 0
|
||||
param_name = str(commands[offset].name)
|
||||
expression_list = param.expression_list()
|
||||
offset = 1 if expression_list[0] in ['*', '**'] else 0
|
||||
param_name = str(expression_list[offset].name)
|
||||
|
||||
# add the listener
|
||||
listener = ParamListener()
|
||||
@@ -259,8 +259,8 @@ def _scan_statement(stmt, search_name, assignment_details=False):
|
||||
|
||||
check = list(stmt.expression_list())
|
||||
if assignment_details:
|
||||
for commands, op in stmt.assignment_details:
|
||||
check += commands
|
||||
for expression_list, op in stmt.assignment_details:
|
||||
check += expression_list
|
||||
|
||||
result = []
|
||||
for c in check:
|
||||
@@ -465,10 +465,10 @@ def check_flow_information(evaluator, flow, search_name, pos):
|
||||
def _check_isinstance_type(evaluator, stmt, search_name):
|
||||
from jedi.evaluate import representation as er
|
||||
try:
|
||||
commands = stmt.expression_list()
|
||||
expression_list = stmt.expression_list()
|
||||
# this might be removed if we analyze and, etc
|
||||
assert len(commands) == 1
|
||||
call = commands[0]
|
||||
assert len(expression_list) == 1
|
||||
call = expression_list[0]
|
||||
assert isinstance(call, pr.Call) and str(call.name) == 'isinstance'
|
||||
assert bool(call.execution)
|
||||
|
||||
|
||||
@@ -594,12 +594,12 @@ class Execution(Executable):
|
||||
values=[value]))
|
||||
key, value = next(var_arg_iterator, (None, None))
|
||||
|
||||
commands = param.expression_list()
|
||||
expression_list = param.expression_list()
|
||||
keys = []
|
||||
values = []
|
||||
array_type = None
|
||||
ignore_creation = False
|
||||
if commands[0] == '*':
|
||||
if expression_list[0] == '*':
|
||||
# *args param
|
||||
array_type = pr.Array.TUPLE
|
||||
if value:
|
||||
@@ -610,7 +610,7 @@ class Execution(Executable):
|
||||
var_arg_iterator.push_back((key, value))
|
||||
break
|
||||
values.append(value)
|
||||
elif commands[0] == '**':
|
||||
elif expression_list[0] == '**':
|
||||
# **kwargs param
|
||||
array_type = pr.Array.DICT
|
||||
if non_matching_keys:
|
||||
@@ -633,7 +633,7 @@ class Execution(Executable):
|
||||
|
||||
# Just ignore all the params that are without a key, after one
|
||||
# keyword argument was set.
|
||||
if not ignore_creation and (not keys_only or commands[0] == '**'):
|
||||
if not ignore_creation and (not keys_only or expression_list[0] == '**'):
|
||||
keys_used.add(str(key))
|
||||
result.append(gen_param_name_copy(param, keys=keys,
|
||||
values=values, array_type=array_type))
|
||||
@@ -663,11 +663,11 @@ class Execution(Executable):
|
||||
stmt._expression_list = [old]
|
||||
|
||||
# *args
|
||||
commands = stmt.expression_list()
|
||||
if not len(commands):
|
||||
expression_list = stmt.expression_list()
|
||||
if not len(expression_list):
|
||||
continue
|
||||
if commands[0] == '*':
|
||||
arrays = self._evaluator.eval_expression_list(commands[1:])
|
||||
if expression_list[0] == '*':
|
||||
arrays = self._evaluator.eval_expression_list(expression_list[1:])
|
||||
# *args must be some sort of an array, otherwise -> ignore
|
||||
|
||||
for array in arrays:
|
||||
@@ -678,8 +678,8 @@ class Execution(Executable):
|
||||
for field_stmt in array.iter_content():
|
||||
yield None, helpers.FakeStatement(field_stmt)
|
||||
# **kwargs
|
||||
elif commands[0] == '**':
|
||||
arrays = self._evaluator.eval_expression_list(commands[1:])
|
||||
elif expression_list[0] == '**':
|
||||
arrays = self._evaluator.eval_expression_list(expression_list[1:])
|
||||
for array in arrays:
|
||||
if isinstance(array, Array):
|
||||
for key_stmt, value_stmt in array.items():
|
||||
@@ -868,10 +868,10 @@ class Array(use_metaclass(CachedMetaClass, pr.Base, Iterable)):
|
||||
index = None
|
||||
for i, key_statement in enumerate(self._array.keys):
|
||||
# Because we only want the key to be a string.
|
||||
key_commands = key_statement.expression_list()
|
||||
if len(key_commands) != 1: # cannot deal with complex strings
|
||||
key_expression_list = key_statement.expression_list()
|
||||
if len(key_expression_list) != 1: # cannot deal with complex strings
|
||||
continue
|
||||
key = key_commands[0]
|
||||
key = key_expression_list[0]
|
||||
if isinstance(key, pr.String):
|
||||
str_key = key.value
|
||||
elif isinstance(key, pr.Name):
|
||||
|
||||
Reference in New Issue
Block a user