diff options
author | Samuel Williams <[email protected]> | 2023-09-04 13:31:25 +1200 |
---|---|---|
committer | GitHub <[email protected]> | 2023-09-04 13:31:25 +1200 |
commit | 7e0f5df2f99693267d61636d23da47f79924e9d5 (patch) | |
tree | 6ef82052cd726d4c83ee44296573aa48843bb52d /compile.c | |
parent | 40ab77eb3dd075536bcc3a6c225a7c245c247db8 (diff) |
Don't reset line coverage for evaled code. (#8330)
* Add failing test.
Notes
Notes:
Merged-By: ioquatix <[email protected]>
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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)) { |