ruby-changes:42578
From: nobu <ko1@a...>
Date: Wed, 20 Apr 2016 10:55:32 +0900 (JST)
Subject: [ruby-changes:42578] nobu:r54652 (trunk): compile.c: make SyntaxError after formatting
nobu 2016-04-20 11:52:07 +0900 (Wed, 20 Apr 2016) New Revision: 54652 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54652 Log: compile.c: make SyntaxError after formatting * compile.c (append_compile_error): make SyntaxError instance by rb_syntax_error_append on demand after formatting the message. Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 54651) +++ compile.c (revision 54652) @@ -319,11 +319,16 @@ append_compile_error(rb_iseq_t *iseq, in https://github.com/ruby/ruby/blob/trunk/compile.c#L319 { VALUE err_info = ISEQ_COMPILE_DATA(iseq)->err_info; VALUE file = iseq->body->location.path; + VALUE err = err_info; va_list args; va_start(args, fmt); - rb_syntax_error_append(err_info, file, line, -1, NULL, fmt, args); + err = rb_syntax_error_append(err, file, line, -1, NULL, fmt, args); va_end(args); + if (NIL_P(err_info)) { + RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, err); + rb_set_errinfo(err); + } } static void @@ -341,13 +346,7 @@ NOINLINE(static compile_error_func prepa https://github.com/ruby/ruby/blob/trunk/compile.c#L346 static compile_error_func prepare_compile_error(rb_iseq_t *iseq) { - VALUE err_info = ISEQ_COMPILE_DATA(iseq)->err_info; if (compile_debug) return &compile_bug; - if (NIL_P(err_info)) { - err_info = rb_exc_new_cstr(rb_eSyntaxError, ""); - RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, err_info); - } - rb_set_errinfo(err_info); return &append_compile_error; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/