aboutsummaryrefslogtreecommitdiffstats
path: root/node.h
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-04 14:24:16 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-04 14:24:16 +0000
commit1e646277c9a79661f25e61d838da901cb61823de (patch)
treee93349e2c178a202d3fb4688db0ed76358b3a97a /node.h
parent0bd3f0080cca094dd2fcd72b72988a0a0934a484 (diff)
downloadruby-1e646277c9a79661f25e61d838da901cb61823de.tar.gz
Avoid usage of the magic number `(NODE*)-1`
This magic number has two meanings depending upon the context: * "required keyword argument (no name)" on NODE_LASGN (`def foo(x:)`) * "rest argument (no name)" on NODE_MASGN and NODE_POSTARG ('a, b, * = ary` or `a, b, *, z = ary`) To show this intention explicitly, two macros are introduced: NODE_SPECIAL_REQUIRED_KEYWORD and NODE_SPECIAL_NO_NAME_REST. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'node.h')
-rw-r--r--node.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/node.h b/node.h
index 848ef1b76e..d85f86746a 100644
--- a/node.h
+++ b/node.h
@@ -445,6 +445,9 @@ typedef struct RNode {
#define NEW_ATTRASGN(r,m,a) NEW_NODE(NODE_ATTRASGN,r,m,a)
#define NEW_PRELUDE(p,b,o) NEW_NODE(NODE_PRELUDE,p,b,o)
+#define NODE_SPECIAL_REQUIRED_KEYWORD ((NODE *)-1)
+#define NODE_SPECIAL_NO_NAME_REST ((NODE *)-1)
+
RUBY_SYMBOL_EXPORT_BEGIN
typedef struct node_buffer_struct node_buffer_t;