avoid SEGV in instance_eval without block.
instance_eval does not yield self. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
39802186b2
commit
78b2714b60
@ -1168,11 +1168,16 @@ yield_under(VALUE under, VALUE self, VALUE values)
|
|||||||
block.self = self;
|
block.self = self;
|
||||||
th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
|
th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
|
||||||
}
|
}
|
||||||
cref = vm_cref_push(th, under, NOEX_PUBLIC, &block);
|
cref = vm_cref_push(th, under, NOEX_PUBLIC, blockptr);
|
||||||
cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
|
cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
|
||||||
|
|
||||||
if (values == Qundef) {
|
if (values == Qundef) {
|
||||||
|
#if 0
|
||||||
|
/* The behavior of Ruby 1.8 */
|
||||||
return vm_yield_with_cref(th, 1, &self, cref);
|
return vm_yield_with_cref(th, 1, &self, cref);
|
||||||
|
#else
|
||||||
|
return vm_yield_with_cref(th, 0, 0, cref);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_PTR(values), cref);
|
return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_PTR(values), cref);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user