vm_eval.c: error message encoding
* vm_eval.c (rb_search_method_entry): preserve encoding of method ID in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
be604acda7
commit
34c635456c
20
vm_eval.c
20
vm_eval.c
@ -490,35 +490,35 @@ rb_search_method_entry(VALUE recv, ID mid, VALUE *defined_class_ptr)
|
|||||||
VALUE flags, 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 `%"PRIsVALUE"' called on unexpected immediate object (%p)",
|
||||||
rb_id2name(mid), (void *)recv);
|
rb_id2str(mid), (void *)recv);
|
||||||
}
|
}
|
||||||
flags = RBASIC(recv)->flags;
|
flags = RBASIC(recv)->flags;
|
||||||
klass = RBASIC(recv)->klass;
|
klass = RBASIC(recv)->klass;
|
||||||
if (flags == 0) {
|
if (flags == 0) {
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%s' called on terminated object"
|
"method `%"PRIsVALUE"' called on terminated object"
|
||||||
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
|
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
|
||||||
rb_id2name(mid), (void *)recv, flags, klass);
|
rb_id2str(mid), (void *)recv, flags, 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 && T_OBJECT <= type && type < T_NIL)
|
if (typestr && T_OBJECT <= type && type < T_NIL)
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%s' called on hidden %s object"
|
"method `%"PRIsVALUE"' 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, flags, klass);
|
rb_id2str(mid), typestr, (void *)recv, flags, klass);
|
||||||
if (typestr)
|
if (typestr)
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%s' called on unexpected %s object"
|
"method `%"PRIsVALUE"' called on unexpected %s object"
|
||||||
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
|
" (%p flags=0x%"PRIxVALUE" klass=0x%"PRIxVALUE")",
|
||||||
rb_id2name(mid), typestr, (void *)recv, flags, klass);
|
rb_id2str(mid), typestr, (void *)recv, flags, klass);
|
||||||
else
|
else
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%s' called on broken T_???" "(0x%02x) object"
|
"method `%"PRIsVALUE"' 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, flags, klass);
|
rb_id2str(mid), type, (void *)recv, flags, klass);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rb_method_entry(klass, mid, defined_class_ptr);
|
return rb_method_entry(klass, mid, defined_class_ptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user