Allow eval to see top scope

Fixes [Bug #20856]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
This commit is contained in:
Kevin Newton 2024-11-04 14:57:52 -05:00
parent 4120f2babd
commit 4203c70dfa
Notes: git 2024-11-05 22:08:52 +00:00

View File

@ -1682,7 +1682,7 @@ pm_eval_make_iseq(VALUE src, VALUE fname, int line,
int scopes_count = 0;
do {
scopes_count++;
} while ((iseq = ISEQ_BODY(iseq)->parent_iseq) && (ISEQ_BODY(iseq)->type != ISEQ_TYPE_TOP));
} while ((iseq = ISEQ_BODY(iseq)->parent_iseq));
pm_options_scopes_init(&result.options, scopes_count + 1);
// Walk over the scope tree, adding known locals at the correct depths. The