compile.c: Remove the magical (const NODE*) -1
It is used to represent "no default expression" for keyword argument: `def foo(key:)`. This change uses NODE_SPECIAL_REQUIRED_KEYWORD.
This commit is contained in:
parent
0872ea5330
commit
0b0c6cb7e4
@ -1556,7 +1556,7 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
|
|||||||
const NODE *val_node = node->nd_body->nd_value;
|
const NODE *val_node = node->nd_body->nd_value;
|
||||||
VALUE dv;
|
VALUE dv;
|
||||||
|
|
||||||
if (val_node == (const NODE *)-1) {
|
if (val_node == NODE_SPECIAL_REQUIRED_KEYWORD) {
|
||||||
++rkw;
|
++rkw;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -8012,7 +8012,7 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, const NODE *node, in
|
|||||||
LABEL *end_label = NEW_LABEL(nd_line(node));
|
LABEL *end_label = NEW_LABEL(nd_line(node));
|
||||||
const NODE *default_value = node->nd_body->nd_value;
|
const NODE *default_value = node->nd_body->nd_value;
|
||||||
|
|
||||||
if (default_value == (const NODE *)-1) {
|
if (default_value == NODE_SPECIAL_REQUIRED_KEYWORD) {
|
||||||
/* required argument. do nothing */
|
/* required argument. do nothing */
|
||||||
COMPILE_ERROR(ERROR_ARGS "unreachable");
|
COMPILE_ERROR(ERROR_ARGS "unreachable");
|
||||||
goto ng;
|
goto ng;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user