[前][次][番号順一覧][スレッド一覧]

ruby-changes:36376

From: nobu <ko1@a...>
Date: Sun, 16 Nov 2014 17:33:53 +0900 (JST)
Subject: [ruby-changes:36376] nobu:r48457 (trunk): id.def: move IDs for exception

nobu	2014-11-16 17:33:35 +0900 (Sun, 16 Nov 2014)

  New Revision: 48457

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48457

  Log:
    id.def: move IDs for exception
    
    * defs/id.def: add :mesg and :exception and move from other
      sources.

  Modified files:
    trunk/defs/id.def
    trunk/error.c
    trunk/eval.c
    trunk/io.c
    trunk/vm_eval.c
Index: defs/id.def
===================================================================
--- defs/id.def	(revision 48456)
+++ defs/id.def	(revision 48457)
@@ -39,6 +39,8 @@ firstline, predefined = __LINE__+1, %[\ https://github.com/ruby/ruby/blob/trunk/defs/id.def#L39
   bt
   bt_locations
   call
+  mesg
+  exception
 
   _                                                     UScore
   "/*NULL*/"                                            NULL
Index: io.c
===================================================================
--- io.c	(revision 48456)
+++ io.c	(revision 48457)
@@ -174,7 +174,8 @@ VALUE rb_default_rs; https://github.com/ruby/ruby/blob/trunk/io.c#L174
 
 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) https://github.com/ruby/ruby/blob/trunk/io.c#L12464
 #ifdef SEEK_HOLE
     sym_HOLE = ID2SYM(rb_intern("HOLE"));
 #endif
-    id_exception = rb_intern("exception");
 }
Index: vm_eval.c
===================================================================
--- vm_eval.c	(revision 48456)
+++ vm_eval.c	(revision 48457)
@@ -25,6 +25,7 @@ static void vm_set_eval_stack(rb_thread_ https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L25
 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 https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1296
 	    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) https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L1785
 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);
 }
Index: eval.c
===================================================================
--- eval.c	(revision 48456)
+++ eval.c	(revision 48457)
@@ -688,7 +688,6 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/eval.c#L688
 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 *ar https://github.com/ruby/ruby/blob/trunk/eval.c#L714
 	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");
 	}
Index: error.c
===================================================================
--- error.c	(revision 48456)
+++ error.c	(revision 48457)
@@ -871,9 +871,7 @@ exc_cause(VALUE exc) https://github.com/ruby/ruby/blob/trunk/error.c#L871
 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 https://github.com/ruby/ruby/blob/trunk/error.c#L887
 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]