summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-16 08:33:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-16 08:33:35 +0000
commitc01aaf60a5ae218a2a2b4de0788553a97519190c (patch)
tree1140490c3ff862b1984856d99760de8306c84985
parent30a5ce7345d314541d2f2013dd3a771c16feee26 (diff)
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
-rw-r--r--defs/id.def2
-rw-r--r--error.c7
-rw-r--r--eval.c4
-rw-r--r--io.c4
-rw-r--r--vm_eval.c5
5 files changed, 9 insertions, 13 deletions
diff --git a/defs/id.def b/defs/id.def
index 6bf1854..d4cd5e7 100644
--- a/defs/id.def
+++ b/defs/id.def
@@ -39,6 +39,8 @@ firstline, predefined = __LINE__+1, %[\
bt
bt_locations
call
+ mesg
+ exception
_ UScore
"/*NULL*/" NULL
diff --git a/error.c b/error.c
index 1e7dac5..7aa939f 100644
--- a/error.c
+++ b/error.c
@@ -871,9 +871,7 @@ exc_cause(VALUE exc)
static VALUE
try_convert_to_exception(VALUE obj)
{
- ID id_exception;
- CONST_ID(id_exception, "exception");
- return rb_check_funcall(obj, id_exception, 0, 0);
+ return rb_check_funcall(obj, idException, 0, 0);
}
/*
@@ -889,10 +887,9 @@ static VALUE
exc_equal(VALUE exc, VALUE obj)
{
VALUE mesg, backtrace;
- ID id_mesg;
+ const ID id_mesg = idMesg;
if (exc == obj) return Qtrue;
- CONST_ID(id_mesg, "mesg");
if (rb_obj_class(exc) != rb_obj_class(obj)) {
int status = 0;
diff --git a/eval.c b/eval.c
index 451588b..1494e1d 100644
--- a/eval.c
+++ b/eval.c
@@ -688,7 +688,6 @@ static VALUE
make_exception(int argc, const VALUE *argv, int isstr)
{
VALUE mesg, exc;
- ID exception;
int n;
mesg = Qnil;
@@ -715,8 +714,7 @@ make_exception(int argc, const VALUE *argv, int isstr)
n = 1;
exception_call:
if (sysstack_error_p(exc)) return exc;
- CONST_ID(exception, "exception");
- mesg = rb_check_funcall(exc, exception, n, argv+1);
+ mesg = rb_check_funcall(exc, idException, n, argv+1);
if (mesg == Qundef) {
rb_raise(rb_eTypeError, "exception class/object expected");
}
diff --git a/io.c b/io.c
index 7845cec..a5173a1 100644
--- a/io.c
+++ b/io.c
@@ -174,7 +174,8 @@ VALUE rb_default_rs;
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_textmode, sym_binmode, sym_autoclose;
static VALUE sym_SET, sym_CUR, sym_END;
@@ -12463,5 +12464,4 @@ Init_IO(void)
#ifdef SEEK_HOLE
sym_HOLE = ID2SYM(rb_intern("HOLE"));
#endif
- id_exception = rb_intern("exception");
}
diff --git a/vm_eval.c b/vm_eval.c
index 3d2c7fe..b14917d 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -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 VALUE rb_eUncaughtThrow;
+#define id_mesg idMesg
/* vm_backtrace.c */
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;
if (file == Qundef) {
VALUE mesg, errat, bt2;
- ID id_mesg;
- CONST_ID(id_mesg, "mesg");
errat = rb_get_backtrace(errinfo);
mesg = rb_attr_get(errinfo, id_mesg);
if (!NIL_P(errat) && RB_TYPE_P(errat, T_ARRAY) &&
@@ -1786,7 +1785,7 @@ uncaught_throw_value(VALUE exc)
static VALUE
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);
return rb_str_format(1, &tag, mesg);
}