diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-06-17 16:53:21 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2021-06-17 16:53:21 +0900 |
| commit | 63bafca7f5e1eb0e11f57875363ab5e5aa7cc8b6 (patch) | |
| tree | 82412729f6d837e3477c4545011b3b13495f5709 /src/variable.c | |
| parent | 090356ec3b237e75cd4e6213685675fd092e6816 (diff) | |
| download | mruby-63bafca7f5e1eb0e11f57875363ab5e5aa7cc8b6.tar.gz mruby-63bafca7f5e1eb0e11f57875363ab5e5aa7cc8b6.zip | |
variable.c: refactor `mrb_vm_const_get` function.
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/variable.c b/src/variable.c index e1200bc3d..bf421955b 100644 --- a/src/variable.c +++ b/src/variable.c @@ -803,9 +803,9 @@ mrb_vm_const_get(mrb_state *mrb, mrb_sym sym) struct RClass *c; struct RClass *c2; mrb_value v; - const struct RProc *proc; + const struct RProc *proc = mrb->c->ci->proc; - c = MRB_PROC_TARGET_CLASS(mrb->c->ci->proc); + c = MRB_PROC_TARGET_CLASS(proc); if (!c) c = mrb->object_class; if (iv_get(mrb, c->iv, sym, &v)) { return v; @@ -821,8 +821,7 @@ mrb_vm_const_get(mrb_state *mrb, mrb_sym sym) c2 = mrb_class_ptr(klass); } if (c2 && (c2->tt == MRB_TT_CLASS || c2->tt == MRB_TT_MODULE)) c = c2; - mrb_assert(!MRB_PROC_CFUNC_P(mrb->c->ci->proc)); - proc = mrb->c->ci->proc; + proc = proc->upper; while (proc) { c2 = MRB_PROC_TARGET_CLASS(proc); if (c2 && iv_get(mrb, c2->iv, sym, &v)) { |
