* vm_method.c (rb_alias): fix a case which try non-existing method alias.
* test/ruby/test_alias.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
53163f8138
commit
b5dd85f049
@ -1,3 +1,9 @@
|
|||||||
|
Thu Jul 16 17:41:28 2009 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
|
* vm_method.c (rb_alias): fix a case which try non-existing method alias.
|
||||||
|
|
||||||
|
* test/ruby/test_alias.rb: add a test.
|
||||||
|
|
||||||
Thu Jul 16 15:52:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu Jul 16 15:52:25 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* bignum.c (rb_big_new, rb_bigzero_p), range.c (rb_range_values):
|
* bignum.c (rb_big_new, rb_bigzero_p), range.c (rb_range_values):
|
||||||
|
@ -61,4 +61,12 @@ class TestAlias < Test::Unit::TestCase
|
|||||||
}.call
|
}.call
|
||||||
assert_raise(SecurityError) { d.mm }
|
assert_raise(SecurityError) { d.mm }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_nonexistmethod
|
||||||
|
assert_raise(NameError){
|
||||||
|
Class.new{
|
||||||
|
alias_method :foobarxyzzy, :barbaz
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -814,10 +814,9 @@ rb_alias(VALUE klass, ID name, ID def)
|
|||||||
if (!orig_me || orig_me->type == VM_METHOD_TYPE_UNDEF) {
|
if (!orig_me || orig_me->type == VM_METHOD_TYPE_UNDEF) {
|
||||||
if (TYPE(klass) == T_MODULE) {
|
if (TYPE(klass) == T_MODULE) {
|
||||||
orig_me = search_method(rb_cObject, def);
|
orig_me = search_method(rb_cObject, def);
|
||||||
|
}
|
||||||
if (!orig_me || !orig_me->type == VM_METHOD_TYPE_UNDEF) {
|
if (!orig_me || !orig_me->type == VM_METHOD_TYPE_UNDEF) {
|
||||||
rb_print_undef(klass, def, 0);
|
rb_print_undef(klass, def, 0);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FL_TEST(klass, FL_SINGLETON)) {
|
if (FL_TEST(klass, FL_SINGLETON)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user