mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-02 02:03:21 +08:00
exchanged assignment_details order (another refactoring)
This commit is contained in:
@@ -299,7 +299,7 @@ def find_name(scope, name_str, position=None, search_global=False,
|
||||
return False
|
||||
|
||||
is_exe = False
|
||||
for op, assignee in par.assignment_details:
|
||||
for assignee, op in par.assignment_details:
|
||||
is_exe |= is_execution(assignee)
|
||||
|
||||
if is_exe:
|
||||
@@ -308,7 +308,7 @@ def find_name(scope, name_str, position=None, search_global=False,
|
||||
pass
|
||||
else:
|
||||
details = par.assignment_details
|
||||
if details and details[0][0] != '=':
|
||||
if details and details[0][1] != '=':
|
||||
no_break_scope = True
|
||||
|
||||
# TODO this makes self variables non-breakable. wanted?
|
||||
@@ -549,7 +549,7 @@ def follow_statement(stmt, seek_name=None):
|
||||
print(seek_name, stmt, stmt.assignment_details)
|
||||
if len(stmt.get_set_vars()) > 1 and seek_name and stmt.assignment_details:
|
||||
new_result = []
|
||||
for op, set_vars in stmt.assignment_details:
|
||||
for set_vars, op in stmt.assignment_details:
|
||||
new_result += assign_tuples(set_vars, result, seek_name)
|
||||
result = new_result
|
||||
return set(result)
|
||||
|
||||
@@ -710,7 +710,7 @@ class Statement(Simple):
|
||||
return list(result)
|
||||
|
||||
def get_code(self, new_line=True):
|
||||
def assemble(assignment, command_list):
|
||||
def assemble(command_list, assignment=None):
|
||||
pieces = [c.get_code() if isinstance(c, Call) else c
|
||||
for c in command_list]
|
||||
if assignment is None:
|
||||
@@ -718,7 +718,7 @@ class Statement(Simple):
|
||||
return '%s %s ' % (''.join(pieces), assignment)
|
||||
|
||||
code = ''.join(assemble(*a) for a in self._assignment_details)
|
||||
code += assemble(None, self.get_commands())
|
||||
code += assemble(self.get_commands())
|
||||
|
||||
if new_line:
|
||||
return code + '\n'
|
||||
@@ -855,7 +855,7 @@ class Statement(Simple):
|
||||
if is_assignment(tok):
|
||||
# This means, there is an assignment here.
|
||||
# Add assignments, which can be more than one
|
||||
self._assignment_details.append((tok, result))
|
||||
self._assignment_details.append((result, tok))
|
||||
result = []
|
||||
is_chain = False
|
||||
continue
|
||||
@@ -898,7 +898,7 @@ class Statement(Simple):
|
||||
start_pos, add_el)
|
||||
result = [arr]
|
||||
if is_assignment(break_tok):
|
||||
self._assignment_details.append((break_tok, result))
|
||||
self._assignment_details.append((result, break_tok))
|
||||
result = []
|
||||
is_chain = False
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user