mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mrb_method_search_vm() should gives the defined class.
Otherwise `super` may call a wrong method.
This commit is contained in:
+1
-1
@@ -186,7 +186,7 @@ typedef struct {
|
||||
|
||||
#ifdef MRB_METHOD_CACHE
|
||||
struct mrb_cache_entry {
|
||||
struct RClass *c;
|
||||
struct RClass *c, *c0;
|
||||
mrb_sym mid;
|
||||
mrb_method_t m;
|
||||
};
|
||||
|
||||
@@ -1398,6 +1398,7 @@ mrb_method_search_vm(mrb_state *mrb, struct RClass **cp, mrb_sym mid)
|
||||
struct mrb_cache_entry *mc = &mrb->cache[h];
|
||||
|
||||
if (mc->c == c && mc->mid == mid) {
|
||||
*cp = mc->c0;
|
||||
return mc->m;
|
||||
}
|
||||
#endif
|
||||
@@ -1413,6 +1414,7 @@ mrb_method_search_vm(mrb_state *mrb, struct RClass **cp, mrb_sym mid)
|
||||
*cp = c;
|
||||
#ifdef MRB_METHOD_CACHE
|
||||
mc->c = oc;
|
||||
mc->c0 = c;
|
||||
mc->mid = mid;
|
||||
mc->m = m;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user