diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-14 11:39:58 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-14 11:39:58 +0000 |
commit | 3c96f9c76a82907d0201cd3af5f5f2d1c2c48850 (patch) | |
tree | 5237bedb5d8191d95c7cb41579f1b0856b0adaec /compile.c | |
parent | 3651c0aa00747c584fadeeae2d9bf50da4ed675a (diff) | |
download | ruby-3c96f9c76a82907d0201cd3af5f5f2d1c2c48850.tar.gz |
Fix a consistency bug of ISEQ_COVERAGE [Bug #13305]
There is an invariant that ISEQ_COVERAGE(iseq) must be Qnil if and only
if option->coverage_enabled is false. This invariant was broken by
NODE_PRELUDE which updates option->coverage_enabled but not
ISEQ_COVERAGE(iseq).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57971 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -6310,14 +6310,17 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp } case NODE_PRELUDE:{ const rb_compile_option_t *orig_opt = ISEQ_COMPILE_DATA(iseq)->option; + VALUE orig_cov = ISEQ_COVERAGE(iseq); + rb_compile_option_t new_opt = *orig_opt; if (node->nd_orig) { - rb_compile_option_t new_opt = *orig_opt; rb_iseq_make_compile_option(&new_opt, node->nd_orig); ISEQ_COMPILE_DATA(iseq)->option = &new_opt; } + if (!new_opt.coverage_enabled) ISEQ_COVERAGE_SET(iseq, Qfalse); CHECK(COMPILE_POPPED(ret, "prelude", node->nd_head)); CHECK(COMPILE_(ret, "body", node->nd_body, popped)); ISEQ_COMPILE_DATA(iseq)->option = orig_opt; + ISEQ_COVERAGE_SET(iseq, orig_cov); break; } case NODE_LAMBDA:{ |