From ca2d47c20f91dc0ceec72052c28717bb0d7a74ef Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 18 Sep 2019 10:31:28 +0900 Subject: Fix `super` from aliased methods to work correctly; fix #4718 We needed to preserve the original method name somewhere. We kept it in the `env` structure pointed from aliased methods. #1457 and #1531 tried to address this issue. But this patch is more memory efficient. Limitation: this fix does not support `super` from methods defined by `define_method`. This limitation may be addressed in the future, but it's low priority. --- src/proc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/proc.c') diff --git a/src/proc.c b/src/proc.c index 5283e5a3e..5f32fcfd1 100644 --- a/src/proc.c +++ b/src/proc.c @@ -77,6 +77,9 @@ closure_setup(mrb_state *mrb, struct RProc *p) e->c = tc; mrb_field_write_barrier(mrb, (struct RBasic*)e, (struct RBasic*)tc); } + if (MRB_PROC_ENV_P(up) && MRB_PROC_ENV(up)->cxt == NULL) { + e->mid = MRB_PROC_ENV(up)->mid; + } } if (e) { p->e.env = e; -- cgit v1.2.3