From 766478f6a781cb4c1f5f9f9e1f5a0751745ec040 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 7 May 2014 04:26:49 +0000 Subject: vm_eval.c: valid name IDs only * vm.c (vm_collect_local_variables_in_heap): use struct local_var_list instead of VALUE directly. * vm_eval.c (local_var_list_update): add valid name IDs only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 4d41575..5e387fe 100644 --- a/vm.c +++ b/vm.c @@ -516,21 +516,18 @@ vm_make_env_each(rb_thread_t * const th, rb_control_frame_t * const cfp, } static int -collect_local_variables_in_iseq(rb_iseq_t *iseq, const VALUE vars) +collect_local_variables_in_iseq(rb_iseq_t *iseq, const struct local_var_list *vars) { int i; if (!iseq) return 0; for (i = 0; i < iseq->local_table_size; i++) { - ID lid = iseq->local_table[i]; - if (rb_is_local_id(lid)) { - rb_hash_aset(vars, ID2SYM(lid), Qtrue); - } + local_var_list_add(vars, iseq->local_table[i]); } return 1; } static int -collect_local_variables_in_env(rb_env_t *env, const VALUE vars) +collect_local_variables_in_env(rb_env_t *env, const struct local_var_list *vars) { while (collect_local_variables_in_iseq(env->block.iseq, vars), @@ -541,7 +538,7 @@ collect_local_variables_in_env(rb_env_t *env, const VALUE vars) } static int -vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *ep, VALUE vars) +vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *ep, const struct local_var_list *vars) { if (ENV_IN_HEAP_P(th, ep)) { rb_env_t *env; -- cgit v1.1