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