diff options
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index 6c2137b7b3..1bc499f1b5 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1045,7 +1045,15 @@ rb_scope_visibility_get(void) static int rb_scope_module_func_check(void) { - return CREF_SCOPE_VISI(rb_vm_cref())->module_func; + rb_thread_t *th = GET_THREAD(); + rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); + + if (!vm_env_cref_by_cref(cfp->ep)) { + return FALSE; + } + else { + return CREF_SCOPE_VISI(rb_vm_cref())->module_func; + } } static void |