mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
eval_error.c: rb_print_inaccessible
* eval_error.c (rb_print_inaccessible): exract from mnew_from_me() in proc.c git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46961 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
61fd977798
commit
c56b3d1418
3 changed files with 22 additions and 12 deletions
22
eval_error.c
22
eval_error.c
|
@ -208,8 +208,8 @@ ruby_error_print(void)
|
|||
error_print();
|
||||
}
|
||||
|
||||
void
|
||||
rb_print_undef(VALUE klass, ID id, int scope)
|
||||
static const char *
|
||||
method_scope_name(int scope)
|
||||
{
|
||||
const char *v;
|
||||
|
||||
|
@ -219,6 +219,13 @@ rb_print_undef(VALUE klass, ID id, int scope)
|
|||
case NOEX_PRIVATE: v = " private"; break;
|
||||
case NOEX_PROTECTED: v = " protected"; break;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
void
|
||||
rb_print_undef(VALUE klass, ID id, int scope)
|
||||
{
|
||||
const char *v = method_scope_name(scope);
|
||||
rb_name_error(id, "undefined%s method `%"PRIsVALUE"' for %s `%"PRIsVALUE"'", v,
|
||||
QUOTE_ID(id),
|
||||
(RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
|
||||
|
@ -234,6 +241,17 @@ rb_print_undef_str(VALUE klass, VALUE name)
|
|||
rb_class_name(klass));
|
||||
}
|
||||
|
||||
void
|
||||
rb_print_inaccessible(VALUE klass, ID id, int scope)
|
||||
{
|
||||
const char *v = method_scope_name(scope);
|
||||
rb_name_error(id, "method `%s' for %s `% "PRIsVALUE"' is %s",
|
||||
rb_id2name(id),
|
||||
(RB_TYPE_P(klass, T_MODULE)) ? "module" : "class",
|
||||
rb_class_name(klass),
|
||||
v);
|
||||
}
|
||||
|
||||
static int
|
||||
sysexit_status(VALUE err)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue