aboutsummaryrefslogtreecommitdiffstats
path: root/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/proc.c b/proc.c
index 021442ad93..0eba245dee 100644
--- a/proc.c
+++ b/proc.c
@@ -384,6 +384,8 @@ bind_eval(int argc, VALUE *argv, VALUE bindval)
return rb_f_eval(argc+1, args, Qnil /* self will be searched in eval */);
}
+VALUE rb_vm_bh_to_procval(rb_thread_t *th, VALUE block_handler);
+
static const VALUE *
get_local_variable_ptr(const rb_env_t **envp, ID lid)
{
@@ -397,6 +399,16 @@ get_local_variable_ptr(const rb_env_t **envp, ID lid)
for (i=0; i<iseq->body->local_table_size; i++) {
if (iseq->body->local_table[i] == lid) {
+ if (iseq->body->local_iseq == iseq &&
+ iseq->body->param.flags.has_block &&
+ (unsigned int)iseq->body->param.block_start == i) {
+ const VALUE *ep = env->ep;
+ if (!VM_ENV_FLAGS(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM)) {
+ RB_OBJ_WRITE(env, &env->env[i], rb_vm_bh_to_procval(GET_THREAD(), VM_ENV_BLOCK_HANDLER(ep)));
+ VM_ENV_FLAGS_SET(ep, VM_FRAME_FLAG_MODIFIED_BLOCK_PARAM);
+ }
+ }
+
*envp = env;
return &env->env[i];
}