diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-01-06 14:04:50 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-01-06 14:04:50 +0900 |
| commit | 07e8f800408c412f90f26ddb85b497beec3f1ce6 (patch) | |
| tree | 549ff88baf343674360610cd0538cc765d5da3b8 /src/proc.c | |
| parent | 91fbbe2f59ed3dff3ebc02cb38e4d10681f74064 (diff) | |
| download | mruby-07e8f800408c412f90f26ddb85b497beec3f1ce6.tar.gz mruby-07e8f800408c412f90f26ddb85b497beec3f1ce6.zip | |
adjust proc->target_class according to surrounding proc->target_class; based on a patch from @Fleurer; close #1627
Diffstat (limited to 'src/proc.c')
| -rw-r--r-- | src/proc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/proc.c b/src/proc.c index b2bbe2453..1ae1d495e 100644 --- a/src/proc.c +++ b/src/proc.c @@ -17,9 +17,16 @@ struct RProc * mrb_proc_new(mrb_state *mrb, mrb_irep *irep) { struct RProc *p; + mrb_callinfo *ci = mrb->c->ci; p = (struct RProc*)mrb_obj_alloc(mrb, MRB_TT_PROC, mrb->proc_class); - p->target_class = (mrb->c->ci) ? mrb->c->ci->target_class : 0; + p->target_class = 0; + if (ci) { + if (ci->proc) + p->target_class = ci->proc->target_class; + if (!p->target_class) + p->target_class = ci->target_class; + } p->body.irep = irep; p->env = 0; mrb_irep_incref(mrb, irep); |
