mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 15:51:51 +08:00
fixed a little statement assignment problem
This commit is contained in:
@@ -193,6 +193,8 @@ class Parser(CachedModule):
|
|||||||
code += parsing.indent_block('%s\n\n' % ret)
|
code += parsing.indent_block('%s\n\n' % ret)
|
||||||
else:
|
else:
|
||||||
# generation of code with mixins
|
# generation of code with mixins
|
||||||
|
# the parser only supports basic functions with a newline after
|
||||||
|
# the double dots
|
||||||
# find doc_str place
|
# find doc_str place
|
||||||
pos = re.search(r'\):\s*\n', mixin).end()
|
pos = re.search(r'\):\s*\n', mixin).end()
|
||||||
if pos is None:
|
if pos is None:
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ def gen():
|
|||||||
yield 1
|
yield 1
|
||||||
yield ""
|
yield ""
|
||||||
|
|
||||||
gen_exe = t12343 + gen()
|
gen_exe = gen()
|
||||||
|
|
||||||
def dec(func):
|
def dec(func):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|||||||
@@ -601,8 +601,8 @@ class Statement(Simple):
|
|||||||
if tok in ['return', 'yield'] or level == 0 and \
|
if tok in ['return', 'yield'] or level == 0 and \
|
||||||
'=' in tok and not tok in ['>=', '<=', '==', '!=']:
|
'=' in tok and not tok in ['>=', '<=', '==', '!=']:
|
||||||
# This means, there is an assignment here.
|
# This means, there is an assignment here.
|
||||||
# TODO there may be multiple assignments: a = b = 1
|
|
||||||
|
|
||||||
|
# Add assignments, which can be more than one
|
||||||
self._assignment_details.append((tok, top))
|
self._assignment_details.append((tok, top))
|
||||||
# All these calls wouldn't be important if nonlocal would
|
# All these calls wouldn't be important if nonlocal would
|
||||||
# exist. -> Initialize the first item again.
|
# exist. -> Initialize the first item again.
|
||||||
@@ -668,7 +668,7 @@ class Statement(Simple):
|
|||||||
close_brackets = False
|
close_brackets = False
|
||||||
is_chain = True
|
is_chain = True
|
||||||
elif tok == ',':
|
elif tok == ',':
|
||||||
if is_call_or_close():
|
while is_call_or_close():
|
||||||
result = result.parent
|
result = result.parent
|
||||||
close_brackets = False
|
close_brackets = False
|
||||||
result.add_field()
|
result.add_field()
|
||||||
@@ -687,7 +687,7 @@ class Statement(Simple):
|
|||||||
#result = result.parent
|
#result = result.parent
|
||||||
close_brackets = True
|
close_brackets = True
|
||||||
else:
|
else:
|
||||||
if is_call_or_close():
|
while is_call_or_close():
|
||||||
result = result.parent
|
result = result.parent
|
||||||
close_brackets = False
|
close_brackets = False
|
||||||
result.add_to_current_field(tok)
|
result.add_to_current_field(tok)
|
||||||
|
|||||||
Reference in New Issue
Block a user