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):
self.compile_time_value_error(e)
def explicit_args_kwds(self):
if (self.keyword_args and not isinstance(self.keyword_args, DictNode) or
not isinstance(self.positional_args, TupleNode)):
if (self.keyword_args and not self.keyword_args.is_dict_literal or
not self.positional_args.is_sequence_constructor):
raise CompileError(self.pos,
'Compile-time keyword arguments must be explicit.')
return self.positional_args.args, self.keyword_args
......@@ -5284,7 +5284,7 @@ class GeneralCallNode(CallNode):
if not isinstance(self.positional_args, TupleNode):
# has starred argument
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
return self
function = self.function
......@@ -5472,8 +5472,8 @@ class AsTupleNode(ExprNode):
code.put_gotref(self.py_result())
class KeywordArgsNode(ExprNode):
# Helper class for keyword arguments.
class MergedDictNode(ExprNode):
# Helper class for keyword arguments and other merged dicts.
#
# keyword_args [DictNode or other ExprNode]
......
......@@ -4220,7 +4220,7 @@ class PyClassDefNode(ClassDefNode):
else:
assert self.metaclass is not None
else:
# KeywordArgsNode
# MergedDictNode
self.mkw = ExprNodes.ProxyNode(keyword_args)
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):
keyword_dict = kwargs[0]
else:
# 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
......
cimport cython
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_passthrough(f):
"""
>>> def f(a=1): return a
......@@ -19,7 +19,7 @@ def wrap_passthrough(f):
return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def unused(*args, **kwargs):
"""
>>> unused()
......@@ -30,7 +30,7 @@ def unused(*args, **kwargs):
return args
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def used_in_closure(**kwargs):
"""
>>> used_in_closure()
......@@ -44,7 +44,7 @@ def used_in_closure(**kwargs):
return func()
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def modify_in_closure(**kwargs):
"""
>>> func = modify_in_closure()
......@@ -61,7 +61,7 @@ def modify_in_closure(**kwargs):
return func
@cython.test_assert_path_exists('//KeywordArgsNode')
@cython.test_assert_path_exists('//MergedDictNode')
def wrap_passthrough_more(f):
"""
>>> def f(a=1, test=2):
......@@ -80,7 +80,7 @@ def wrap_passthrough_more(f):
return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_passthrough2(f):
"""
>>> def f(a=1): return a
......@@ -99,7 +99,7 @@ def wrap_passthrough2(f):
return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_modify(f):
"""
>>> def f(a=1, test=2):
......@@ -123,7 +123,7 @@ def wrap_modify(f):
return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_modify_mix(f):
"""
>>> def f(a=1, test=2):
......@@ -148,7 +148,7 @@ def wrap_modify_mix(f):
return wrapper
@cython.test_assert_path_exists('//KeywordArgsNode')
@cython.test_assert_path_exists('//MergedDictNode')
def wrap_modify_func(f):
"""
>>> def f(a=1, test=2):
......@@ -175,7 +175,7 @@ def wrap_modify_func(f):
return wrapper
@cython.test_assert_path_exists('//KeywordArgsNode')
@cython.test_assert_path_exists('//MergedDictNode')
def wrap_modify_func_mix(f):
"""
>>> def f(a=1, test=2):
......@@ -203,7 +203,7 @@ def wrap_modify_func_mix(f):
return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def wrap_reassign(f):
"""
>>> def f(a=1, test=2):
......@@ -227,7 +227,7 @@ def wrap_reassign(f):
return wrapper
@cython.test_fail_if_path_exists('//KeywordArgsNode')
@cython.test_fail_if_path_exists('//MergedDictNode')
def kwargs_metaclass(**kwargs):
"""
>>> 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