diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-31 07:52:40 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-03-31 07:52:40 +0000 |
commit | 4273aa8e722c88b04ff0828b6a3c9e6b25988231 (patch) | |
tree | 343e998ef902e2ef978e2b376191ed9f205f76a5 /vm_insnhelper.c | |
parent | 3044423f9404af026305c18ef40a1460f1dd8308 (diff) |
* vm_insnhelper.c (vm_get_ev_const): search root cref properly.
[ruby-dev:43365]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 00a21e3669..508ad8584e 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -1155,16 +1155,16 @@ vm_get_ev_const(rb_thread_t *th, const rb_iseq_t *iseq, if (orig_klass == Qnil) { /* in current lexical scope */ - const NODE *cref = vm_get_cref(iseq, th->cfp->lfp, th->cfp->dfp); - const NODE *root_cref = NULL; + const NODE *root_cref = vm_get_cref(iseq, th->cfp->lfp, th->cfp->dfp); + const NODE *cref; VALUE klass = orig_klass; + while (root_cref && root_cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL) { + root_cref = root_cref->nd_next; + } + cref = root_cref; while (cref && cref->nd_next) { - if (!(cref->flags & NODE_FL_CREF_PUSHED_BY_EVAL)) { - klass = cref->nd_clss; - if (root_cref == NULL) - root_cref = cref; - } + klass = cref->nd_clss; cref = cref->nd_next; if (!NIL_P(klass)) { |