summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-06-04 23:15:14 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-06-04 23:17:19 +0900
commit0b0c6cb7e4fa17247cb214c4eaf924617a55e9a7 (patch)
tree66aa111493dcfce17d0953818621fbafd131e28c /compile.c
parent0872ea53303499caf3584e40f2a5438e86eb4fed (diff)
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.
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index e1a8885960..889dc32280 100644
--- a/compile.c
+++ b/compile.c
@@ -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;
VALUE dv;
- if (val_node == (const NODE *)-1) {
+ if (val_node == NODE_SPECIAL_REQUIRED_KEYWORD) {
++rkw;
}
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));
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 */
COMPILE_ERROR(ERROR_ARGS "unreachable");
goto ng;