summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-12 07:41:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-12 07:41:35 +0000
commit14a730e91ee6176cc60ba3fc1cd368e47bd2f7b0 (patch)
tree4d355f722daedd8acdb45a77c0dbaf239f2713b3 /iseq.c
parent257fd90166f62943ff767e5cd7b0624c12074a8b (diff)
immediate message mode of compile error
* compile.c (append_compile_error): set Qtrue for erred state with showing the message immediately. * iseq.c (prepare_iseq_build): make immediate message mode if main or top level context, not to show the failed path twice in the first line. * iseq.c (cleanup_iseq_build): raise default message exception if immediate message mode. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/iseq.c b/iseq.c
index 07d8828e9b..81edd37c47 100644
--- a/iseq.c
+++ b/iseq.c
@@ -272,6 +272,10 @@ prepare_iseq_build(rb_iseq_t *iseq,
const rb_compile_option_t *option)
{
VALUE coverage = Qfalse;
+ VALUE err_info = Qnil;
+
+ if (parent && (type == ISEQ_TYPE_MAIN || type == ISEQ_TYPE_TOP))
+ err_info = Qfalse;
iseq->body->type = type;
set_relation(iseq, parent);
@@ -286,7 +290,7 @@ prepare_iseq_build(rb_iseq_t *iseq,
RB_OBJ_WRITE(iseq, &iseq->body->mark_ary, iseq_mark_ary_create(0));
ISEQ_COMPILE_DATA(iseq) = ZALLOC(struct iseq_compile_data);
- RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, Qnil);
+ RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->err_info, err_info);
RB_OBJ_WRITE(iseq, &ISEQ_COMPILE_DATA(iseq)->mark_ary, rb_ary_tmp_new(3));
ISEQ_COMPILE_DATA(iseq)->storage_head = ISEQ_COMPILE_DATA(iseq)->storage_current =
@@ -325,6 +329,7 @@ cleanup_iseq_build(rb_iseq_t *iseq)
compile_data_free(data);
if (RTEST(err)) {
+ if (err == Qtrue) err = rb_exc_new_cstr(rb_eSyntaxError, "compile error");
rb_funcallv(err, rb_intern("set_backtrace"), 1, &iseq->body->location.path);
rb_exc_raise(err);
}