[前][次][番号順一覧][スレッド一覧]

ruby-changes:64884

From: Nobuyoshi <ko1@a...>
Date: Thu, 14 Jan 2021 16:59:47 +0900 (JST)
Subject: [ruby-changes:64884] 6bcc4664bd (master): Return new NODE_LIT

https://git.ruby-lang.org/ruby.git/commit/?id=6bcc4664bd

From 6bcc4664bdaebbf9b28a762ae63f476a1ec6cfb2 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Thu, 14 Jan 2021 16:15:25 +0900
Subject: Return new NODE_LIT

As NODE_ZLIST/NODE_LIST are not markable, cannot be reused as
NODE_LIT.

diff --git a/parse.y b/parse.y
index 29784f3..ddaa9f6 100644
--- a/parse.y
+++ b/parse.y
@@ -11148,9 +11148,7 @@ shareable_literal_constant(struct parser_params *p, enum shareability shareable, https://github.com/ruby/ruby/blob/trunk/parse.y#L11148
       case NODE_ZLIST:
 	lit = rb_ary_new();
 	OBJ_FREEZE_RAW(lit);
-	nd_set_type(value, NODE_LIT);
-	RB_OBJ_WRITE(p->ast, &value->nd_lit, lit);
-	return value;
+	return NEW_LIT(lit, loc);
 
       case NODE_LIST:
 	lit = rb_ary_new();
@@ -11235,8 +11233,7 @@ shareable_literal_constant(struct parser_params *p, enum shareability shareable, https://github.com/ruby/ruby/blob/trunk/parse.y#L11233
 	value = make_shareable_node(p, value, false, loc);
     }
     else {
-	nd_set_type(value, NODE_LIT);
-	RB_OBJ_WRITE(p->ast, &value->nd_lit, rb_ractor_make_shareable(lit));
+	value = NEW_LIT(rb_ractor_make_shareable(lit), loc);
     }
 
     return value;
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]