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

* proc.c (mnew): fix wrong error message when Kernel#public_method

receives name of private method.  [Bug #2425]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2010-04-22 14:15:29 +00:00
parent 0ffb18de45
commit 478c65c468
2 changed files with 15 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu Apr 22 23:10:59 2010 Yusuke Endoh <mame@tsg.ne.jp>
* proc.c (mnew): fix wrong error message when Kernel#public_method
receives name of private method. [Bug #2425]
Thu Apr 22 22:56:42 2010 Yusuke Endoh <mame@tsg.ne.jp>
* bootstraptest/test_thread.rb: fix test. [Bug #2342]

11
proc.c
View file

@ -925,7 +925,16 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope)
if (flag == NOEX_UNDEF) {
flag = me->flag;
if (scope && (flag & NOEX_MASK) != NOEX_PUBLIC) {
rb_print_undef(rclass, def->original_id, (int)(flag & NOEX_MASK));
const char *v = "";
switch (flag & NOEX_MASK) {
case NOEX_PRIVATE: v = "private"; break;
case NOEX_PROTECTED: v = "protected"; break;
}
rb_name_error(id, "method `%s' for %s `%s' is %s",
rb_id2name(id),
(TYPE(klass) == T_MODULE) ? "module" : "class",
rb_class2name(klass),
v);
}
}
if (def && def->type == VM_METHOD_TYPE_ZSUPER) {