mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-10 07:41:51 +08:00
def/class keywords after an opening parentheses led to empty arrays without closing brackets, tests & fixes #416
This commit is contained in:
@@ -1023,7 +1023,11 @@ isinstance(c, (tokenize.Token, Operator)) else unicode(c)
|
|||||||
# always dictionaries and not sets.
|
# always dictionaries and not sets.
|
||||||
arr.type = Array.DICT
|
arr.type = Array.DICT
|
||||||
|
|
||||||
arr.end_pos = (break_tok or stmt or old_stmt).end_pos
|
try:
|
||||||
|
arr.end_pos = (break_tok or stmt or old_stmt).end_pos
|
||||||
|
except UnboundLocalError:
|
||||||
|
# In case of something like `(def`
|
||||||
|
arr.end_pos = start_pos[0], start_pos[1] + 1
|
||||||
return arr, break_tok
|
return arr, break_tok
|
||||||
|
|
||||||
def parse_stmt(token_iterator, maybe_dict=False, added_breaks=(),
|
def parse_stmt(token_iterator, maybe_dict=False, added_breaks=(),
|
||||||
|
|||||||
@@ -25,3 +25,12 @@ IndentIssues().one_param()
|
|||||||
|
|
||||||
#? str()
|
#? str()
|
||||||
IndentIssues().with_param('')
|
IndentIssues().with_param('')
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
Just because there's a def keyword, doesn't mean it should not be able to
|
||||||
|
complete to definition.
|
||||||
|
"""
|
||||||
|
definition = 0
|
||||||
|
#? ['definition', 'def']
|
||||||
|
str(def
|
||||||
|
|||||||
Reference in New Issue
Block a user