summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c14
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)) {