summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2023-09-04 13:31:25 +1200
committerGitHub <noreply@github.com>2023-09-04 13:31:25 +1200
commit7e0f5df2f99693267d61636d23da47f79924e9d5 (patch)
tree6ef82052cd726d4c83ee44296573aa48843bb52d /compile.c
parent40ab77eb3dd075536bcc3a6c225a7c245c247db8 (diff)
Don't reset line coverage for evaled code. (#8330)
* Add failing test.
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compile.c b/compile.c
index 4d344fff9c..ba78040048 100644
--- a/compile.c
+++ b/compile.c
@@ -2336,7 +2336,8 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor)
!(rb_get_coverage_mode() & COVERAGE_TARGET_ONESHOT_LINES)) {
int line = iobj->insn_info.line_no - 1;
if (line >= 0 && line < RARRAY_LEN(ISEQ_LINE_COVERAGE(iseq))) {
- RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line, INT2FIX(0));
+ if (RARRAY_AREF(ISEQ_LINE_COVERAGE(iseq), line) == Qnil)
+ RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line, INT2FIX(0));
}
}
if (ISEQ_BRANCH_COVERAGE(iseq) && (events & RUBY_EVENT_COVERAGE_BRANCH)) {