summaryrefslogtreecommitdiff
path: root/ruby_parser.c
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-04-03 19:28:55 +0900
committerYuichiro Kaneko <[email protected]>2024-04-04 08:44:10 +0900
commit60567731051885acf38a3f91899f0d6d62d4898b (patch)
treeac394caa7a77711955e6bd24e96060c794d843be /ruby_parser.c
parent4ef99905a6dcb48799bd4ec46628ff8686c633e9 (diff)
Move shareable_constant_value logic from parse.y to compile.c
Diffstat (limited to 'ruby_parser.c')
-rw-r--r--ruby_parser.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/ruby_parser.c b/ruby_parser.c
index b674474f8c..60acf642a6 100644
--- a/ruby_parser.c
+++ b/ruby_parser.c
@@ -994,54 +994,3 @@ rb_node_encoding_val(const NODE *node)
{
return rb_enc_from_encoding(RNODE_ENCODING(node)->enc);
}
-
-VALUE
-rb_node_const_decl_val(const NODE *node)
-{
- VALUE path;
- switch (nd_type(node)) {
- case NODE_CDECL:
- if (RNODE_CDECL(node)->nd_vid) {
- path = rb_id2str(RNODE_CDECL(node)->nd_vid);
- goto end;
- }
- else {
- node = RNODE_CDECL(node)->nd_else;
- }
- break;
- case NODE_COLON2:
- break;
- case NODE_COLON3:
- // ::Const
- path = rb_str_new_cstr("::");
- rb_str_append(path, rb_id2str(RNODE_COLON3(node)->nd_mid));
- goto end;
- default:
- rb_bug("unexpected node: %s", ruby_node_name(nd_type(node)));
- UNREACHABLE_RETURN(0);
- }
-
- path = rb_ary_new();
- if (node) {
- for (; node && nd_type_p(node, NODE_COLON2); node = RNODE_COLON2(node)->nd_head) {
- rb_ary_push(path, rb_id2str(RNODE_COLON2(node)->nd_mid));
- }
- if (node && nd_type_p(node, NODE_CONST)) {
- // Const::Name
- rb_ary_push(path, rb_id2str(RNODE_CONST(node)->nd_vid));
- }
- else if (node && nd_type_p(node, NODE_COLON3)) {
- // ::Const::Name
- rb_ary_push(path, rb_id2str(RNODE_COLON3(node)->nd_mid));
- rb_ary_push(path, rb_str_new(0, 0));
- }
- else {
- // expression::Name
- rb_ary_push(path, rb_str_new_cstr("..."));
- }
- path = rb_ary_join(rb_ary_reverse(path), rb_str_new_cstr("::"));
- }
- end:
- path = rb_fstring(path);
- return path;
-}