From bc343b851d04f68ef7554a2cca0bad63a32c2b7d Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 19 Mar 2016 05:46:20 +0000 Subject: SyntaxError message at iseq compile * iseq.c (rb_iseq_compile_with_option): make the parser in mild error. * load.c (rb_load_internal0): ditto. * parse.y (yycompile0): return the error message within the error to be raised. [Feature #11951] * parse.y (parser_compile_error): accumulate error messages in the error_buffer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- load.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'load.c') diff --git a/load.c b/load.c index 4558e2c6fd..f00cceb696 100644 --- a/load.c +++ b/load.c @@ -583,7 +583,6 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) int state; volatile VALUE wrapper = th->top_wrapper; volatile VALUE self = th->top_self; - volatile int mild_compile_error; #if !defined __GNUC__ rb_thread_t *volatile th0 = th; #endif @@ -600,7 +599,6 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) rb_extend_object(th->top_self, th->top_wrapper); } - mild_compile_error = th->mild_compile_error; TH_PUSH_TAG(th); state = EXEC_TAG(); if (state == 0) { @@ -611,10 +609,10 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) /* OK */ } else { - th->mild_compile_error++; - node = (NODE *)rb_load_file_str(fname); + VALUE parser = rb_parser_new(); + rb_parser_mild_error(parser); + node = (NODE *)rb_parser_load_file(parser, fname); iseq = rb_iseq_new_top(node, rb_str_new2(""), fname, rb_realpath_internal(Qnil, fname, 1), NULL); - th->mild_compile_error--; } rb_iseq_eval(iseq); } @@ -624,7 +622,6 @@ rb_load_internal0(rb_thread_t *th, VALUE fname, int wrap) th = th0; fname = RB_GC_GUARD(fname); #endif - th->mild_compile_error = mild_compile_error; th->top_self = self; th->top_wrapper = wrapper; -- cgit v1.2.3