1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Moved the common code

This commit is contained in:
Nobuyoshi Nakada 2021-10-13 13:00:57 +09:00
parent bad61d34be
commit 1b35808a13
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

9
vm.c
View file

@ -982,15 +982,16 @@ collect_outer_variable_names(ID id, VALUE val, void *ptr)
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;
}