mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_method.c (rb_add_method_def): nothing to do if old method had
same definition. [ruby-dev:39397] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5e4d04c36e
commit
1fe57a4b5d
3 changed files with 22 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Sep 29 13:37:50 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* vm_method.c (rb_add_method_def): nothing to do if old method had
|
||||||
|
same definition. [ruby-dev:39397]
|
||||||
|
|
||||||
Tue Sep 29 06:50:32 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
Tue Sep 29 06:50:32 2009 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (rb_str_inspect): dump as \uXXXX when the
|
* string.c (rb_str_inspect): dump as \uXXXX when the
|
||||||
|
|
|
@ -130,6 +130,14 @@ class TestClass < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_equal("", stderr)
|
assert_equal("", stderr)
|
||||||
|
stderr = verbose_warning do
|
||||||
|
Module.new do
|
||||||
|
module_function
|
||||||
|
def foo; end
|
||||||
|
module_function :foo
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert_equal("", stderr, '[ruby-dev:39397]')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_check_inheritable
|
def test_check_inheritable
|
||||||
|
|
11
vm_method.c
11
vm_method.c
|
@ -141,6 +141,8 @@ rb_free_method_entry(rb_method_entry_t *me)
|
||||||
xfree(me);
|
xfree(me);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2);
|
||||||
|
|
||||||
static rb_method_entry_t *
|
static rb_method_entry_t *
|
||||||
rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definition_t *def, rb_method_flag_t noex)
|
rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definition_t *def, rb_method_flag_t noex)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +181,7 @@ rb_add_method_def(VALUE klass, ID mid, rb_method_type_t type, rb_method_definiti
|
||||||
rb_method_entry_t *old_me = (rb_method_entry_t *)data;
|
rb_method_entry_t *old_me = (rb_method_entry_t *)data;
|
||||||
rb_method_definition_t *old_def = old_me->def;
|
rb_method_definition_t *old_def = old_me->def;
|
||||||
|
|
||||||
if (old_def == def) return old_me;
|
if (rb_method_definition_eq(old_def, def)) return old_me;
|
||||||
rb_vm_check_redefinition_opt_method(old_me);
|
rb_vm_check_redefinition_opt_method(old_me);
|
||||||
|
|
||||||
if (RTEST(ruby_verbose) &&
|
if (RTEST(ruby_verbose) &&
|
||||||
|
@ -791,7 +793,12 @@ rb_mod_protected_method_defined(VALUE mod, VALUE mid)
|
||||||
int
|
int
|
||||||
rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2)
|
rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2)
|
||||||
{
|
{
|
||||||
const rb_method_definition_t *d1 = m1->def, *d2 = m2->def;
|
return rb_method_definition_eq(m1->def, m2->def);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2)
|
||||||
|
{
|
||||||
if (!d1) {
|
if (!d1) {
|
||||||
return !d2;
|
return !d2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue