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

ruby-changes:41845

From: nobu <ko1@a...>
Date: Thu, 25 Feb 2016 16:21:22 +0900 (JST)
Subject: [ruby-changes:41845] nobu:r53919 (trunk): eval_error.c: error position format

nobu	2016-02-25 16:22:01 +0900 (Thu, 25 Feb 2016)

  New Revision: 53919

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

  Log:
    eval_error.c: error position format
    
    * eval_error.c (error_print): use same error position format when
      no backtrace too.

  Modified files:
    trunk/eval_error.c
Index: eval_error.c
===================================================================
--- eval_error.c	(revision 53918)
+++ eval_error.c	(revision 53919)
@@ -87,6 +87,7 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L87
     volatile VALUE eclass = Qundef, e = Qundef;
     const char *volatile einfo;
     volatile long elen;
+    VALUE mesg;
 
     if (NIL_P(errinfo))
 	return;
@@ -105,28 +106,13 @@ error_print(void) https://github.com/ruby/ruby/blob/trunk/eval_error.c#L106
     else {
 	goto no_message;
     }
-    if (NIL_P(errat)) {
-	int line;
-	const char *file = rb_source_loc(&line);
-	if (!file)
-	    warn_printf("%d: ", line);
-	else if (!line)
-	    warn_printf("%s: ", file);
-	else
-	    warn_printf("%s:%d: ", file, line);
-    }
-    else if (RARRAY_LEN(errat) == 0) {
+    if (NIL_P(errat) || RARRAY_LEN(errat) == 0 ||
+	NIL_P(mesg = RARRAY_AREF(errat, 0))) {
 	error_pos();
     }
     else {
-	VALUE mesg = RARRAY_AREF(errat, 0);
-
-	if (NIL_P(mesg))
-	    error_pos();
-	else {
-	    warn_print_str(mesg);
-	    warn_print(": ");
-	}
+	warn_print_str(mesg);
+	warn_print(": ");
     }
 
     eclass = CLASS_OF(errinfo);

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

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