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

ruby-changes:41843

From: nobu <ko1@a...>
Date: Thu, 25 Feb 2016 13:41:37 +0900 (JST)
Subject: [ruby-changes:41843] nobu:r53917 (trunk): eval_error.c: colon in message

nobu	2016-02-25 13:42:16 +0900 (Thu, 25 Feb 2016)

  New Revision: 53917

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

  Log:
    eval_error.c: colon in message
    
    * eval_error.c (error_pos): include a clone after the position.
    
    * eval_error.c (error_print, error_handle): do not print a colon
      if the error position is unavailable.

  Modified files:
    trunk/eval_error.c
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 53916)
+++ eval_error.c	(revision 53917)
@@ -28,14 +28,15 @@ error_pos(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L28
     if (sourcefile) {
 	ID caller_name;
 	if (sourceline == 0) {
-	    warn_printf("%"PRIsVALUE, sourcefile);
+	    warn_printf("%"PRIsVALUE": ", sourcefile);
 	}
 	else if ((caller_name = rb_frame_callee()) != 0) {
-	    warn_printf("%"PRIsVALUE":%d:in `%"PRIsVALUE"'", sourcefile, sourceline,
+	    warn_printf("%"PRIsVALUE":%d:in `%"PRIsVALUE"': ",
+			sourcefile, sourceline,
 			rb_id2str(caller_name));
 	}
 	else {
-	    warn_printf("%"PRIsVALUE":%d", sourcefile, sourceline);
+	    warn_printf("%"PRIsVALUE":%d: ", sourcefile, sourceline);
 	}
     }
 }
@@ -108,11 +109,11 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L109
 	int line;
 	const char *file = rb_source_loc(&line);
 	if (!file)
-	    warn_printf("%d", line);
+	    warn_printf("%d: ", line);
 	else if (!line)
-	    warn_printf("%s", file);
+	    warn_printf("%s: ", file);
 	else
-	    warn_printf("%s:%d", file, line);
+	    warn_printf("%s:%d: ", file, line);
     }
     else if (RARRAY_LEN(errat) == 0) {
 	error_pos();
@@ -124,6 +125,7 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L125
 	    error_pos();
 	else {
 	    warn_print_str(mesg);
+	    warn_print(": ");
 	}
     }
 
@@ -140,14 +142,13 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L142
 	elen = 0;
     }
     if (eclass == rb_eRuntimeError && elen == 0) {
-	warn_print(": unhandled exception\n");
+	warn_print("unhandled exception\n");
     }
     else {
 	VALUE epath;
 
 	epath = rb_class_name(eclass);
 	if (elen == 0) {
-	    warn_print(": ");
 	    warn_print_str(epath);
 	    warn_print("\n");
 	}
@@ -161,7 +162,6 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L162
 		len = tail - einfo;
 		tail++;		/* skip newline */
 	    }
-	    warn_print(": ");
 	    warn_print_str(tail ? rb_str_subseq(e, 0, len) : e);
 	    if (epath) {
 		warn_print(" (");
@@ -282,28 +282,28 @@ error_handle(int ex) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L282
 
       case TAG_RETURN:
 	error_pos();
-	warn_print(": unexpected return\n");
+	warn_print("unexpected return\n");
 	break;
       case TAG_NEXT:
 	error_pos();
-	warn_print(": unexpected next\n");
+	warn_print("unexpected next\n");
 	break;
       case TAG_BREAK:
 	error_pos();
-	warn_print(": unexpected break\n");
+	warn_print("unexpected break\n");
 	break;
       case TAG_REDO:
 	error_pos();
-	warn_print(": unexpected redo\n");
+	warn_print("unexpected redo\n");
 	break;
       case TAG_RETRY:
 	error_pos();
-	warn_print(": retry outside of rescue clause\n");
+	warn_print("retry outside of rescue clause\n");
 	break;
       case TAG_THROW:
 	/* TODO: fix me */
 	error_pos();
-	warn_printf(": unexpected throw\n");
+	warn_print("unexpected throw\n");
 	break;
       case TAG_RAISE: {
 	VALUE errinfo = GET_THREAD()->errinfo;

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

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