mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
id.def: move IDs for exception
* defs/id.def: add :mesg and :exception and move from other sources. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
30a5ce7345
commit
c01aaf60a5
5 changed files with 9 additions and 13 deletions
|
@ -39,6 +39,8 @@ firstline, predefined = __LINE__+1, %[\
|
||||||
bt
|
bt
|
||||||
bt_locations
|
bt_locations
|
||||||
call
|
call
|
||||||
|
mesg
|
||||||
|
exception
|
||||||
|
|
||||||
_ UScore
|
_ UScore
|
||||||
"/*NULL*/" NULL
|
"/*NULL*/" NULL
|
||||||
|
|
7
error.c
7
error.c
|
@ -871,9 +871,7 @@ exc_cause(VALUE exc)
|
||||||
static VALUE
|
static VALUE
|
||||||
try_convert_to_exception(VALUE obj)
|
try_convert_to_exception(VALUE obj)
|
||||||
{
|
{
|
||||||
ID id_exception;
|
return rb_check_funcall(obj, idException, 0, 0);
|
||||||
CONST_ID(id_exception, "exception");
|
|
||||||
return rb_check_funcall(obj, id_exception, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -889,10 +887,9 @@ static VALUE
|
||||||
exc_equal(VALUE exc, VALUE obj)
|
exc_equal(VALUE exc, VALUE obj)
|
||||||
{
|
{
|
||||||
VALUE mesg, backtrace;
|
VALUE mesg, backtrace;
|
||||||
ID id_mesg;
|
const ID id_mesg = idMesg;
|
||||||
|
|
||||||
if (exc == obj) return Qtrue;
|
if (exc == obj) return Qtrue;
|
||||||
CONST_ID(id_mesg, "mesg");
|
|
||||||
|
|
||||||
if (rb_obj_class(exc) != rb_obj_class(obj)) {
|
if (rb_obj_class(exc) != rb_obj_class(obj)) {
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
4
eval.c
4
eval.c
|
@ -688,7 +688,6 @@ static VALUE
|
||||||
make_exception(int argc, const VALUE *argv, int isstr)
|
make_exception(int argc, const VALUE *argv, int isstr)
|
||||||
{
|
{
|
||||||
VALUE mesg, exc;
|
VALUE mesg, exc;
|
||||||
ID exception;
|
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
mesg = Qnil;
|
mesg = Qnil;
|
||||||
|
@ -715,8 +714,7 @@ make_exception(int argc, const VALUE *argv, int isstr)
|
||||||
n = 1;
|
n = 1;
|
||||||
exception_call:
|
exception_call:
|
||||||
if (sysstack_error_p(exc)) return exc;
|
if (sysstack_error_p(exc)) return exc;
|
||||||
CONST_ID(exception, "exception");
|
mesg = rb_check_funcall(exc, idException, n, argv+1);
|
||||||
mesg = rb_check_funcall(exc, exception, n, argv+1);
|
|
||||||
if (mesg == Qundef) {
|
if (mesg == Qundef) {
|
||||||
rb_raise(rb_eTypeError, "exception class/object expected");
|
rb_raise(rb_eTypeError, "exception class/object expected");
|
||||||
}
|
}
|
||||||
|
|
4
io.c
4
io.c
|
@ -174,7 +174,8 @@ VALUE rb_default_rs;
|
||||||
|
|
||||||
static VALUE argf;
|
static VALUE argf;
|
||||||
|
|
||||||
static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding, id_exception;
|
#define id_exception idException
|
||||||
|
static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding;
|
||||||
static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
|
static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args;
|
||||||
static VALUE sym_textmode, sym_binmode, sym_autoclose;
|
static VALUE sym_textmode, sym_binmode, sym_autoclose;
|
||||||
static VALUE sym_SET, sym_CUR, sym_END;
|
static VALUE sym_SET, sym_CUR, sym_END;
|
||||||
|
@ -12463,5 +12464,4 @@ Init_IO(void)
|
||||||
#ifdef SEEK_HOLE
|
#ifdef SEEK_HOLE
|
||||||
sym_HOLE = ID2SYM(rb_intern("HOLE"));
|
sym_HOLE = ID2SYM(rb_intern("HOLE"));
|
||||||
#endif
|
#endif
|
||||||
id_exception = rb_intern("exception");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ static void vm_set_eval_stack(rb_thread_t * th, VALUE iseqval, const NODE *cref,
|
||||||
static int vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *dfp, const struct local_var_list *vars);
|
static int vm_collect_local_variables_in_heap(rb_thread_t *th, const VALUE *dfp, const struct local_var_list *vars);
|
||||||
|
|
||||||
static VALUE rb_eUncaughtThrow;
|
static VALUE rb_eUncaughtThrow;
|
||||||
|
#define id_mesg idMesg
|
||||||
|
|
||||||
/* vm_backtrace.c */
|
/* vm_backtrace.c */
|
||||||
VALUE rb_vm_backtrace_str_ary(rb_thread_t *th, int lev, int n);
|
VALUE rb_vm_backtrace_str_ary(rb_thread_t *th, int lev, int n);
|
||||||
|
@ -1295,9 +1296,7 @@ eval_string_with_cref(VALUE self, VALUE src, VALUE scope, NODE *const cref_arg,
|
||||||
VALUE errinfo = th->errinfo;
|
VALUE errinfo = th->errinfo;
|
||||||
if (file == Qundef) {
|
if (file == Qundef) {
|
||||||
VALUE mesg, errat, bt2;
|
VALUE mesg, errat, bt2;
|
||||||
ID id_mesg;
|
|
||||||
|
|
||||||
CONST_ID(id_mesg, "mesg");
|
|
||||||
errat = rb_get_backtrace(errinfo);
|
errat = rb_get_backtrace(errinfo);
|
||||||
mesg = rb_attr_get(errinfo, id_mesg);
|
mesg = rb_attr_get(errinfo, id_mesg);
|
||||||
if (!NIL_P(errat) && RB_TYPE_P(errat, T_ARRAY) &&
|
if (!NIL_P(errat) && RB_TYPE_P(errat, T_ARRAY) &&
|
||||||
|
@ -1786,7 +1785,7 @@ uncaught_throw_value(VALUE exc)
|
||||||
static VALUE
|
static VALUE
|
||||||
uncaught_throw_to_s(VALUE exc)
|
uncaught_throw_to_s(VALUE exc)
|
||||||
{
|
{
|
||||||
VALUE mesg = rb_attr_get(exc, rb_intern("mesg"));
|
VALUE mesg = rb_attr_get(exc, id_mesg);
|
||||||
VALUE tag = uncaught_throw_tag(exc);
|
VALUE tag = uncaught_throw_tag(exc);
|
||||||
return rb_str_format(1, &tag, mesg);
|
return rb_str_format(1, &tag, mesg);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue