summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-01 17:57:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-01 17:57:37 +0000
commit1a2b90d5e6c7b6ecd1d4c0ba9445fb730b39776b (patch)
tree973b19a521528d0a87c2c77e7f57cd6707f1cb38 /vm.c
parent0fdb18e513b53e71911c57a7b5fddd86c3a17704 (diff)
vm.c: rb_vm_env_local_variables
* vm.c (rb_vm_env_local_variables): returns array of local variable name symbols in the environment by envval. * proc.c (bind_local_variables): use rb_vm_env_local_variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/vm.c b/vm.c
index a84320b4e3..32beb34d5a 100644
--- a/vm.c
+++ b/vm.c
@@ -566,6 +566,18 @@ vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *ep, const struc
}
}
+VALUE
+rb_vm_env_local_variables(VALUE envval)
+{
+ struct local_var_list vars;
+ const rb_env_t *env;
+
+ GetEnvPtr(envval, env);
+ local_var_list_init(&vars);
+ collect_local_variables_in_env(env, &vars);
+ return local_var_list_finish(&vars);
+}
+
static void vm_rewrite_ep_in_errinfo(rb_thread_t *th);
static VALUE vm_make_proc_from_block(rb_thread_t *th, rb_block_t *block);
static VALUE vm_make_env_object(rb_thread_t * th, rb_control_frame_t *cfp, VALUE *blockprocptr);