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:
parent
bad61d34be
commit
1b35808a13
1 changed files with 5 additions and 4 deletions
9
vm.c
9
vm.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue