diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-20 01:25:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-04-20 01:25:55 +0000 |
commit | 97177a2d99f7c38d6085ccba343a980031aec7cf (patch) | |
tree | 006f7d88aff9629cb1fae9cc244afec1fb0b1ec8 /compile.c | |
parent | 51c195948f32e86226d2a45f810e2d830b573435 (diff) | |
download | ruby-97177a2d99f7c38d6085ccba343a980031aec7cf.tar.gz |
refactor syntax error
* compile.c (append_compile_error): use rb_syntax_error_append.
* error.c (rb_syntax_error_append): append messages into a
SyntaxError exception instance.
* parse.y (yycompile0): make new SyntaxError instance in main
mode, otherwize error_buffer should be a SyntaxError if error
has occurred.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 9 |
1 files changed, 1 insertions, 8 deletions
@@ -318,18 +318,11 @@ static void append_compile_error(rb_iseq_t *iseq, int line, const char *fmt, ...) { VALUE err_info = ISEQ_COMPILE_DATA(iseq)->err_info; - VALUE str = rb_attr_get(err_info, idMesg); VALUE file = iseq->body->location.path; va_list args; - if (RSTRING_LEN(str)) rb_str_cat2(str, "\n"); - if (file) { - rb_str_concat(str, file); - if (line) rb_str_catf(str, ":%d", line); - rb_str_cat2(str, ": "); - } va_start(args, fmt); - rb_str_vcatf(str, fmt, args); + rb_syntax_error_append(err_info, file, line, -1, NULL, fmt, args); va_end(args); } |