diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-06-04 23:15:14 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-06-04 23:17:19 +0900 |
commit | 0b0c6cb7e4fa17247cb214c4eaf924617a55e9a7 (patch) | |
tree | 66aa111493dcfce17d0953818621fbafd131e28c /compile.c | |
parent | 0872ea53303499caf3584e40f2a5438e86eb4fed (diff) | |
download | ruby-0b0c6cb7e4fa17247cb214c4eaf924617a55e9a7.tar.gz |
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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; |