1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Make alias for aliased original method

Chaining aliased methods increases searching cost linearly.
This commit is contained in:
Nobuyoshi Nakada 2021-02-03 17:38:19 +09:00
parent 8df1881c8f
commit 71c746379d
Notes: git 2021-02-03 20:00:10 +09:00

View file

@ -1932,11 +1932,17 @@ rb_alias(VALUE klass, ID alias_name, ID original_name)
}
}
if (orig_me->def->type == VM_METHOD_TYPE_ZSUPER) {
switch (orig_me->def->type) {
case VM_METHOD_TYPE_ZSUPER:
klass = RCLASS_SUPER(klass);
original_name = orig_me->def->original_id;
visi = METHOD_ENTRY_VISI(orig_me);
goto again;
case VM_METHOD_TYPE_ALIAS:
orig_me = orig_me->def->body.alias.original_me;
VM_ASSERT(orig_me->def->type != VM_METHOD_TYPE_ALIAS);
break;
default: break;
}
if (visi == METHOD_VISI_UNDEF) visi = METHOD_ENTRY_VISI(orig_me);