summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorS.H <gamelinks007@gmail.com>2021-12-04 00:01:24 +0900
committerGitHub <noreply@github.com>2021-12-04 00:01:24 +0900
commitec7f14d9fab82b097fb8b58501461cd0e19d6bdf (patch)
treed09084edaf19af87c78cf8ed37d2cfe960b40e0a /ast.c
parent28fb6d6b9e06a632f96244a635a045622a6be276 (diff)
downloadruby-ec7f14d9fab82b097fb8b58501461cd0e19d6bdf.tar.gz
Add `nd_type_p` macro
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ast.c b/ast.c
index 8139fcd390..ceb03c29d4 100644
--- a/ast.c
+++ b/ast.c
@@ -298,7 +298,7 @@ dump_block(rb_ast_t *ast, const NODE *node)
do {
rb_ary_push(ary, NEW_CHILD(ast, node->nd_head));
} while (node->nd_next &&
- nd_type(node->nd_next) == NODE_BLOCK &&
+ nd_type_p(node->nd_next, NODE_BLOCK) &&
(node = node->nd_next, 1));
if (node->nd_next) {
rb_ary_push(ary, NEW_CHILD(ast, node->nd_next));
@@ -313,7 +313,7 @@ dump_array(rb_ast_t *ast, const NODE *node)
VALUE ary = rb_ary_new();
rb_ary_push(ary, NEW_CHILD(ast, node->nd_head));
- while (node->nd_next && nd_type(node->nd_next) == NODE_LIST) {
+ while (node->nd_next && nd_type_p(node->nd_next, NODE_LIST)) {
node = node->nd_next;
rb_ary_push(ary, NEW_CHILD(ast, node->nd_head));
}
@@ -399,7 +399,7 @@ node_children(rb_ast_t *ast, const NODE *node)
while (1) {
rb_ary_push(ary, NEW_CHILD(ast, node->nd_1st));
- if (!node->nd_2nd || nd_type(node->nd_2nd) != (int)type)
+ if (!node->nd_2nd || !nd_type_p(node->nd_2nd, type))
break;
node = node->nd_2nd;
}