summaryrefslogtreecommitdiff
path: root/node_dump.c
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-07-22 16:28:00 +0900
committerYuichiro Kaneko <[email protected]>2024-07-23 14:35:23 +0900
commit57b11be15ae518288b719fb36068ceb23da6e050 ()
tree9a772e11ab2a75c86a3df1f83e67247751b1679e /node_dump.c
parentf23485a8d693cb69fd7b84c1ab93cb4198ecfe4a (diff)
Implement UNLESS NODE keyword locations
Notes: Merged: https://.com/ruby/ruby/pull/11227
-rw-r--r--node_dump.c10
1 files changed, 9 insertions, 1 deletions
@@ -27,6 +27,10 @@
#define A_INT(val) rb_str_catf(buf, "%d", (val))
#define A_LONG(val) rb_str_catf(buf, "%ld", (val))
#define A_LIT(lit) AR(rb_dump_literal(lit))
#define A_NODE_HEADER(node, term) \
rb_str_catf(buf, "@ %s (id: %d, line: %d, location: (%d,%d)-(%d,%d))%s"term, \
ruby_node_name(nd_type(node)), nd_node_id(node), nd_line(node), \
@@ -84,6 +88,7 @@
#define F_LIT(name, type, ann) SIMPLE_FIELD1(#name, ann) A_LIT(type(node)->name)
#define F_VALUE(name, val, ann) SIMPLE_FIELD1(#name, ann) A_LIT(val)
#define F_MSG(name, ann, desc) SIMPLE_FIELD1(#name, ann) A(desc)
#define F_SHAREABILITY(name, type, ann) SIMPLE_FIELD1(#name, ann) A_SHAREABILITY(type(node)->name)
#define F_NODE(name, type, ann) \
@@ -244,8 +249,11 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
ANN("example: unless x == 1 then foo else bar end");
F_NODE(nd_cond, RNODE_UNLESS, "condition expr");
F_NODE(nd_body, RNODE_UNLESS, "then clause");
- LAST_NODE;
F_NODE(nd_else, RNODE_UNLESS, "else clause");
return;
case NODE_CASE: