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

* vm_eval.c (rb_search_method_entry): refine error message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-11-25 11:47:19 +00:00
parent e6f670242c
commit fe97646743
2 changed files with 18 additions and 9 deletions

View file

@ -1,3 +1,7 @@
Wed Nov 25 20:46:37 2009 Tanaka Akira <akr@fsij.org>
* vm_eval.c (rb_search_method_entry): refine error message.
Wed Nov 25 19:29:05 2009 Akinori MUSHA <knu@iDaemons.org> Wed Nov 25 19:29:05 2009 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/digest.c (rb_digest_instance_method_unimpl): Do not * ext/digest/digest.c (rb_digest_instance_method_unimpl): Do not

View file

@ -336,33 +336,38 @@ rb_search_method_entry(VALUE recv, ID mid)
VALUE klass = CLASS_OF(recv); VALUE klass = CLASS_OF(recv);
if (!klass) { if (!klass) {
VALUE flags, klass;
if (IMMEDIATE_P(recv)) { if (IMMEDIATE_P(recv)) {
rb_raise(rb_eNotImpError, rb_raise(rb_eNotImpError,
"method `%s' called on unexpected immediate object (%p)", "method `%s' called on unexpected immediate object (%p)",
rb_id2name(mid), (void *)recv); rb_id2name(mid), (void *)recv);
} }
if (RBASIC(recv)->flags == 0) { flags = RBASIC(recv)->flags;
klass = RBASIC(recv)->klass;
if (flags == 0) {
rb_raise(rb_eNotImpError, rb_raise(rb_eNotImpError,
"method `%s' called on terminated object" "method `%s' called on terminated object"
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")", " (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
rb_id2name(mid), (void *)recv, rb_id2name(mid), (void *)recv, flags, klass);
RBASIC(recv)->flags, RBASIC(recv)->klass);
} }
else { else {
int type = BUILTIN_TYPE(recv); int type = BUILTIN_TYPE(recv);
const char *typestr = rb_type_str(type); const char *typestr = rb_type_str(type);
if (typestr) if (typestr && T_OBJECT <= type && type < T_NIL)
rb_raise(rb_eNotImpError, rb_raise(rb_eNotImpError,
"method `%s' called on hidden %s object" "method `%s' called on hidden %s object"
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")", " (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
rb_id2name(mid), typestr, (void *)recv, rb_id2name(mid), typestr, (void *)recv, flags, klass);
RBASIC(recv)->flags, RBASIC(recv)->klass); if (typestr)
rb_raise(rb_eNotImpError,
"method `%s' called on unexpected %s object"
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
rb_id2name(mid), typestr, (void *)recv, flags, klass);
else else
rb_raise(rb_eNotImpError, rb_raise(rb_eNotImpError,
"method `%s' called on hidden T_???" "(0x%02x) object" "method `%s' called on broken T_???" "(0x%02x) object"
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")", " (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
rb_id2name(mid), type, (void *)recv, rb_id2name(mid), type, (void *)recv, flags, klass);
RBASIC(recv)->flags, RBASIC(recv)->klass);
} }
} }
return rb_method_entry(klass, mid); return rb_method_entry(klass, mid);