summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-12 07:45:49 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-12 07:45:49 (GMT)
commit1abd51ad910ded964b5e6db984517974838f3850 (patch)
tree429727ac6455ef9fef962c2762c7b9449252de0c /vm_method.c
parent2f56ebe8f721ebed920da35586e4c5a1b96b7574 (diff)
vm_method.c: NameError at refined method alias
* vm_method.c (rb_alias): raise a NameError when creating alias to a refined method if the original method of the refined method is not defined. [ruby-core:67523] [Bug #10731] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index 289c77a..a406612 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1278,7 +1278,9 @@ rb_alias(VALUE klass, ID name, ID def)
again:
orig_me = search_method(klass, def, &defined_class);
- if (UNDEFINED_METHOD_ENTRY_P(orig_me)) {
+ if (UNDEFINED_METHOD_ENTRY_P(orig_me) ||
+ (orig_me->def->type == VM_METHOD_TYPE_REFINED &&
+ UNDEFINED_METHOD_ENTRY_P(orig_me->def->body.orig_me))) {
if ((!RB_TYPE_P(klass, T_MODULE)) ||
(orig_me = search_method(rb_cObject, def, 0),
UNDEFINED_METHOD_ENTRY_P(orig_me))) {