aboutsummaryrefslogtreecommitdiffstats
path: root/ast.c
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2024-01-01 01:31:28 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-01-09 16:07:19 +0900
commitdb476cc71cb6c690bd5b32cebebf7ebcbff604ad (patch)
tree3fa0bfc4a58f6016e7cad7304e951b063f94209f /ast.c
parentf82a6172a2a96815f9478410116d35c76b56efb5 (diff)
downloadruby-db476cc71cb6c690bd5b32cebebf7ebcbff604ad.tar.gz
Introduce NODE_SYM to manage symbol literal
`:sym` was managed by `NODE_LIT` with `Symbol` object. This commit introduces `NODE_SYM` so that 1. Symbol literal is detectable from AST Node 2. Reduce dependency on ruby object
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ast.c b/ast.c
index 1fc0a88963..b61dfbf4cb 100644
--- a/ast.c
+++ b/ast.c
@@ -581,6 +581,8 @@ node_children(rb_ast_t *ast, const NODE *node)
}
return rb_ary_new_from_args(3, RNODE_DSTR(node)->nd_lit, head, next);
}
+ case NODE_SYM:
+ return rb_ary_new_from_args(1, rb_node_sym_string_val(node));
case NODE_EVSTR:
return rb_ary_new_from_node_args(ast, 1, RNODE_EVSTR(node)->nd_body);
case NODE_ARGSCAT: