mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
compile.c: pop coverage trace
* compile.c (iseq_compile_each0): pop trace for coverage only and clear its corresponding line. [ruby-core:82726] [Bug #13886] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
93272b35f1
commit
d446f15c97
2 changed files with 12 additions and 1 deletions
|
@ -6594,7 +6594,8 @@ iseq_compile_each0(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *node, int popp
|
|||
((INSN *)saved_last_element)->insn_id == BIN(trace)) {
|
||||
POP_ELEMENT(ret);
|
||||
/* remove trace(coverage) */
|
||||
if (((INSN *)ret->last)->insn_id == BIN(trace)) {
|
||||
if (IS_INSN_ID(ret->last, trace) &&
|
||||
(FIX2LONG(OPERAND_AT(ret->last, 0)) & RUBY_EVENT_COVERAGE)) {
|
||||
POP_ELEMENT(ret);
|
||||
RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line - 1, Qnil);
|
||||
}
|
||||
|
|
|
@ -165,4 +165,14 @@ class TestCoverage < Test::Unit::TestCase
|
|||
}
|
||||
}
|
||||
end
|
||||
|
||||
def test_nocoverage_optimized_line
|
||||
assert_ruby_status(%w[], "#{<<-"begin;"}\n#{<<-'end;'}")
|
||||
begin;
|
||||
def foo(x)
|
||||
x # optimized away
|
||||
nil
|
||||
end
|
||||
end;
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue