summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-03 18:25:57 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-03 18:25:57 +0000
commit7dbfe89630f429255ae346cd02d7ca7d2d109650 (patch)
treee6bb9639b21f89e4f250fe523e3602e6abc05bc5 /vm_eval.c
parent9998481d4efaf86dde652617ed3b2777924c3373 (diff)
* compile.c (compile_cpath, iseq_compile_each): reverted
constant/class variable lookup in instance_eval etc. to the behavior of 1.8. * eval.c (rb_mod_nesting): ditto. * insns.def (putspecialobject, defineclass): ditto. * node.h (NODE_FL_CREF_PUSHED_BY_EVAL): ditto. * vm_core.h (VM_SPECIAL_OBJECT_CONST_BASE): ditto. * vm_eval.c (yield_under, eval_under): ditto. * vm_insnhelper.c (vm_cref_push, vm_get_const_base, vm_get_ev_const, vm_get_cvar_base): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 549b28becc..60c45e0805 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -17,7 +17,7 @@ static inline VALUE vm_yield_with_cref(rb_thread_t *th, int argc, const VALUE *a
static inline VALUE vm_yield(rb_thread_t *th, int argc, const VALUE *argv);
static inline VALUE vm_backtrace(rb_thread_t *th, int lev);
static int vm_backtrace_each(rb_thread_t *th, int lev, rb_backtrace_iter_func *iter, void *arg);
-static NODE *vm_cref_push(rb_thread_t *th, VALUE klass, int noex);
+static NODE *vm_cref_push(rb_thread_t *th, VALUE klass, int noex, rb_block_t *blockptr);
static VALUE vm_exec(rb_thread_t *th);
static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref);
static int vm_collect_local_variables_in_heap(rb_thread_t *th, VALUE *dfp, VALUE ary);
@@ -1161,16 +1161,18 @@ yield_under(VALUE under, VALUE self, VALUE values)
{
rb_thread_t *th = GET_THREAD();
rb_block_t block, *blockptr;
- NODE *cref = vm_cref_push(th, under, NOEX_PUBLIC);
+ NODE *cref;
if ((blockptr = GC_GUARDED_PTR_REF(th->cfp->lfp[0])) != 0) {
block = *blockptr;
block.self = self;
th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
}
+ cref = vm_cref_push(th, under, NOEX_PUBLIC, &block);
+ cref->flags |= NODE_FL_CREF_PUSHED_BY_EVAL;
if (values == Qundef) {
- return vm_yield_with_cref(th, 0, 0, cref);
+ return vm_yield_with_cref(th, 1, &self, cref);
}
else {
return vm_yield_with_cref(th, RARRAY_LENINT(values), RARRAY_PTR(values), cref);
@@ -1181,7 +1183,7 @@ yield_under(VALUE under, VALUE self, VALUE values)
static VALUE
eval_under(VALUE under, VALUE self, VALUE src, const char *file, int line)
{
- NODE *cref = vm_cref_push(GET_THREAD(), under, NOEX_PUBLIC);
+ NODE *cref = vm_cref_push(GET_THREAD(), under, NOEX_PUBLIC, NULL);
if (rb_safe_level() >= 4) {
StringValue(src);