summaryrefslogtreecommitdiff
path: root/vm.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-07 04:26:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-07 04:26:49 +0000
commit766478f6a781cb4c1f5f9f9e1f5a0751745ec040 (patch)
treeea3036bcfc48610784ab48e29aea22f1f69408e2 /vm.c
parenta1bc138fd0f8077b0ea1df2ad9baaac85807aaa8 (diff)
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
Diffstat (limited to 'vm.c')
-rw-r--r--vm.c11
1 files changed, 4 insertions, 7 deletions
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;