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

ruby-changes:68420

From: Nobuyoshi <ko1@a...>
Date: Wed, 13 Oct 2021 13:13:42 +0900 (JST)
Subject: [ruby-changes:68420] 1b35808a13 (master): Moved the common code

https://git.ruby-lang.org/ruby.git/commit/?id=1b35808a13

From 1b35808a13cc69f2014ffa849de8be15139d8e4e Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 13 Oct 2021 13:00:57 +0900
Subject: Moved the common code

---
 vm.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/vm.c b/vm.c
index 785bb0c5cb..03813db448 100644
--- a/vm.c
+++ b/vm.c
@@ -982,15 +982,16 @@ collect_outer_variable_names(ID id, VALUE val, void *ptr) https://github.com/ruby/ruby/blob/trunk/vm.c#L982
         data->yield = true;
     }
     else {
+        VALUE *store;
         if (data->isolate ||
             val == Qtrue /* write */) {
-            if (data->ary == Qfalse) data->ary = rb_ary_new();
-            rb_ary_push(data->ary, ID2SYM(id));
+            store = &data->ary;
         }
         else {
-            if (data->read_only == Qfalse) data->read_only = rb_ary_new();
-            rb_ary_push(data->read_only, ID2SYM(id));
+            store = &data->read_only;
         }
+        if (*store == Qfalse) *store = rb_ary_new();
+        rb_ary_push(*store, ID2SYM(id));
     }
     return ID_TABLE_CONTINUE;
 }
-- 
cgit v1.2.1


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

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