Commit d79afd60 authored by Stefan Behnel's avatar Stefan Behnel

rename KeywordArgsNode to MergedDictNode to generalise it

parent cd794dcd
...@@ -5229,8 +5229,8 @@ class GeneralCallNode(CallNode): ...@@ -5229,8 +5229,8 @@ class GeneralCallNode(CallNode):
self.compile_time_value_error(e) self.compile_time_value_error(e)
def explicit_args_kwds(self): def explicit_args_kwds(self):
if (self.keyword_args and not isinstance(self.keyword_args, DictNode) or if (self.keyword_args and not self.keyword_args.is_dict_literal or
not isinstance(self.positional_args, TupleNode)): not self.positional_args.is_sequence_constructor):
raise CompileError(self.pos, raise CompileError(self.pos,
'Compile-time keyword arguments must be explicit.') 'Compile-time keyword arguments must be explicit.')
return self.positional_args.args, self.keyword_args return self.positional_args.args, self.keyword_args
...@@ -5284,7 +5284,7 @@ class GeneralCallNode(CallNode): ...@@ -5284,7 +5284,7 @@ class GeneralCallNode(CallNode):
if not isinstance(self.positional_args, TupleNode): if not isinstance(self.positional_args, TupleNode):
# has starred argument # has starred argument
return self return self
if not isinstance(self.keyword_args, DictNode): if not self.keyword_args.is_dict_literal:
# keywords come from arbitrary expression => nothing to do here # keywords come from arbitrary expression => nothing to do here
return self return self
function = self.function function = self.function
...@@ -5472,8 +5472,8 @@ class AsTupleNode(ExprNode): ...@@ -5472,8 +5472,8 @@ class AsTupleNode(ExprNode):
code.put_gotref(self.py_result()) code.put_gotref(self.py_result())
class KeywordArgsNode(ExprNode): class MergedDictNode(ExprNode):
# Helper class for keyword arguments. # Helper class for keyword arguments and other merged dicts.
# #
# keyword_args [DictNode or other ExprNode] # keyword_args [DictNode or other ExprNode]
......
...@@ -4220,7 +4220,7 @@ class PyClassDefNode(ClassDefNode): ...@@ -4220,7 +4220,7 @@ class PyClassDefNode(ClassDefNode):
else: else:
assert self.metaclass is not None assert self.metaclass is not None
else: else:
# KeywordArgsNode # MergedDictNode
self.mkw = ExprNodes.ProxyNode(keyword_args) self.mkw = ExprNodes.ProxyNode(keyword_args)
if force_py3_semantics or self.bases or self.mkw or self.metaclass: if force_py3_semantics or self.bases or self.mkw or self.metaclass:
......
...@@ -509,7 +509,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args): ...@@ -509,7 +509,7 @@ def p_call_build_packed_args(pos, positional_args, keyword_args):
keyword_dict = kwargs[0] keyword_dict = kwargs[0]
else: else:
# at least one **kwargs # at least one **kwargs
keyword_dict = ExprNodes.KeywordArgsNode(pos, keyword_args=kwargs) keyword_dict = ExprNodes.MergedDictNode(pos, keyword_args=kwargs)
return arg_tuple, keyword_dict return arg_tuple, keyword_dict
......
cimport cython cimport cython
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_passthrough(f): def wrap_passthrough(f):
""" """
>>> def f(a=1): return a >>> def f(a=1): return a
...@@ -19,7 +19,7 @@ def wrap_passthrough(f): ...@@ -19,7 +19,7 @@ def wrap_passthrough(f):
return wrapper return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def unused(*args, **kwargs): def unused(*args, **kwargs):
""" """
>>> unused() >>> unused()
...@@ -30,7 +30,7 @@ def unused(*args, **kwargs): ...@@ -30,7 +30,7 @@ def unused(*args, **kwargs):
return args return args
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def used_in_closure(**kwargs): def used_in_closure(**kwargs):
""" """
>>> used_in_closure() >>> used_in_closure()
...@@ -44,7 +44,7 @@ def used_in_closure(**kwargs): ...@@ -44,7 +44,7 @@ def used_in_closure(**kwargs):
return func() return func()
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def modify_in_closure(**kwargs): def modify_in_closure(**kwargs):
""" """
>>> func = modify_in_closure() >>> func = modify_in_closure()
...@@ -61,7 +61,7 @@ def modify_in_closure(**kwargs): ...@@ -61,7 +61,7 @@ def modify_in_closure(**kwargs):
return func return func
@cython.test_assert_path_exists('//KeywordArgsNode') @cython.test_assert_path_exists('//MergedDictNode')
def wrap_passthrough_more(f): def wrap_passthrough_more(f):
""" """
>>> def f(a=1, test=2): >>> def f(a=1, test=2):
...@@ -80,7 +80,7 @@ def wrap_passthrough_more(f): ...@@ -80,7 +80,7 @@ def wrap_passthrough_more(f):
return wrapper return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_passthrough2(f): def wrap_passthrough2(f):
""" """
>>> def f(a=1): return a >>> def f(a=1): return a
...@@ -99,7 +99,7 @@ def wrap_passthrough2(f): ...@@ -99,7 +99,7 @@ def wrap_passthrough2(f):
return wrapper return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_modify(f): def wrap_modify(f):
""" """
>>> def f(a=1, test=2): >>> def f(a=1, test=2):
...@@ -123,7 +123,7 @@ def wrap_modify(f): ...@@ -123,7 +123,7 @@ def wrap_modify(f):
return wrapper return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_modify_mix(f): def wrap_modify_mix(f):
""" """
>>> def f(a=1, test=2): >>> def f(a=1, test=2):
...@@ -148,7 +148,7 @@ def wrap_modify_mix(f): ...@@ -148,7 +148,7 @@ def wrap_modify_mix(f):
return wrapper return wrapper
@cython.test_assert_path_exists('//KeywordArgsNode') @cython.test_assert_path_exists('//MergedDictNode')
def wrap_modify_func(f): def wrap_modify_func(f):
""" """
>>> def f(a=1, test=2): >>> def f(a=1, test=2):
...@@ -175,7 +175,7 @@ def wrap_modify_func(f): ...@@ -175,7 +175,7 @@ def wrap_modify_func(f):
return wrapper return wrapper
@cython.test_assert_path_exists('//KeywordArgsNode') @cython.test_assert_path_exists('//MergedDictNode')
def wrap_modify_func_mix(f): def wrap_modify_func_mix(f):
""" """
>>> def f(a=1, test=2): >>> def f(a=1, test=2):
...@@ -203,7 +203,7 @@ def wrap_modify_func_mix(f): ...@@ -203,7 +203,7 @@ def wrap_modify_func_mix(f):
return wrapper return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_reassign(f): def wrap_reassign(f):
""" """
>>> def f(a=1, test=2): >>> def f(a=1, test=2):
...@@ -227,7 +227,7 @@ def wrap_reassign(f): ...@@ -227,7 +227,7 @@ def wrap_reassign(f):
return wrapper return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode') @cython.test_fail_if_path_exists('//MergedDictNode')
def kwargs_metaclass(**kwargs): def kwargs_metaclass(**kwargs):
""" """
>>> K = kwargs_metaclass() >>> K = kwargs_metaclass()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment