From 0d5fecf833ce43b467e9b6f8997799b937c4d589 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 9 Apr 2025 22:29:17 +0900 Subject: [PATCH] variable.c (mrb_const_get): adjust local variable scope --- src/variable.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/variable.c b/src/variable.c index 57f2b15aa..ce55952af 100644 --- a/src/variable.c +++ b/src/variable.c @@ -825,17 +825,15 @@ mrb_const_get(mrb_state *mrb, mrb_value mod, mrb_sym sym) mrb_value mrb_vm_const_get(mrb_state *mrb, mrb_sym sym) { - struct RClass *c; - struct RClass *c2; - mrb_value v; const struct RProc *proc = mrb->c->ci->proc; + struct RClass *c = MRB_PROC_TARGET_CLASS(proc); + mrb_value v; - c = MRB_PROC_TARGET_CLASS(proc); if (!c) c = mrb->object_class; if (iv_get(mrb, class_iv_ptr(c), sym, &v)) { return v; } - c2 = c; + struct RClass *c2 = c; while (c2 && c2->tt == MRB_TT_SCLASS) { mrb_value klass;