1
0
forked from VimPlug/jedi

assignment details description

This commit is contained in:
David Halter
2013-09-01 22:22:20 +04:30
parent 58d3ba37e9
commit 2e97986545

View File

@@ -794,7 +794,10 @@ class Statement(Simple):
"""
if not set_vars:
return set_vars
return []
if _assignment_details():
s
result = set(set_vars)
last = None
in_lookup = 0
@@ -805,14 +808,16 @@ class Statement(Simple):
result.discard(tok)
elif isinstance(tok, tuple):
tok = tok[1]
if in_lookup == 0 and tok == '(':
is_execution = True
for t in self.token_list[:i]:
result.discard(t)
if tok == '[' and isinstance(last, Name):
in_lookup += 1
elif tok == ']' and in_lookup > 0:
in_lookup -= 1
if in_lookup == 0 and tok == '(':
is_execution = True
for t in self.token_list[:i]:
result.discard(t)
if tok in '[(' and isinstance(last, Name):
in_lookup += 1
elif tok in ')]' and in_lookup > 0:
in_lookup -= 1
elif '=' in tok and in_lookup == 0:
break
last = tok
return list(result)
@@ -842,6 +847,15 @@ class Statement(Simple):
@property
def assignment_details(self):
"""
Returns an array of tuples of the elements before the assignment.
For example the following code::
x = (y, z) = 2, ''
would result in ``[(Name(x), '='), (Array([Name(y), Name(z)]), '=')]``.
"""
# parse statement which creates the assignment details.
self.get_commands()
return self._assignment_details