mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 22:14:27 +08:00
Fix issues with random tuples in TreeArgument.
Thanks @micbou for noticing it.
b92c7d3351
This commit is contained in:
@@ -98,10 +98,9 @@ class TreeArguments(AbstractArguments):
|
|||||||
self.trailer = trailer # Can be None, e.g. in a class definition.
|
self.trailer = trailer # Can be None, e.g. in a class definition.
|
||||||
|
|
||||||
def _split(self):
|
def _split(self):
|
||||||
if isinstance(self.argument_node, (tuple, list)):
|
if self.argument_node is None:
|
||||||
for el in self.argument_node:
|
return
|
||||||
yield 0, el
|
|
||||||
else:
|
|
||||||
if not (self.argument_node.type == 'arglist' or (
|
if not (self.argument_node.type == 'arglist' or (
|
||||||
# in python 3.5 **arg is an argument, not arglist
|
# in python 3.5 **arg is an argument, not arglist
|
||||||
(self.argument_node.type == 'argument') and
|
(self.argument_node.type == 'argument') and
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ def _check_name_for_execution(evaluator, context, compare_node, name, trailer):
|
|||||||
def create_func_excs():
|
def create_func_excs():
|
||||||
arglist = trailer.children[1]
|
arglist = trailer.children[1]
|
||||||
if arglist == ')':
|
if arglist == ')':
|
||||||
arglist = ()
|
arglist = None
|
||||||
args = TreeArguments(evaluator, context, arglist, trailer)
|
args = TreeArguments(evaluator, context, arglist, trailer)
|
||||||
if value_node.type == 'funcdef':
|
if value_node.type == 'funcdef':
|
||||||
yield value.get_function_execution(args)
|
yield value.get_function_execution(args)
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ def eval_node(context, element):
|
|||||||
def eval_trailer(context, base_contexts, trailer):
|
def eval_trailer(context, base_contexts, trailer):
|
||||||
trailer_op, node = trailer.children[:2]
|
trailer_op, node = trailer.children[:2]
|
||||||
if node == ')': # `arglist` is optional.
|
if node == ')': # `arglist` is optional.
|
||||||
node = ()
|
node = None
|
||||||
|
|
||||||
if trailer_op == '[':
|
if trailer_op == '[':
|
||||||
trailer_op, node, _ = trailer.children
|
trailer_op, node, _ = trailer.children
|
||||||
|
|||||||
Reference in New Issue
Block a user