[coverage] include 'else' in coverage range
'else' was missing in coverage range, resulting in odd looking reports R=jgruber@chromium.org Bug: v8:7179 Change-Id: I377cc557d51075256da27febdc8ab5442ea04d27 Reviewed-on: https://chromium-review.googlesource.com/816736 Reviewed-by: Marja Hölttä <marja@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#50030}
This commit is contained in:
parent
33373be03c
commit
f5a12d8661
@ -5208,8 +5208,9 @@ typename ParserBase<Impl>::StatementT ParserBase<Impl>::ParseIfStatement(
|
||||
|
||||
StatementT else_statement = impl()->NullStatement();
|
||||
if (Check(Token::ELSE)) {
|
||||
SourceRangeScope range_scope(scanner(), &else_range);
|
||||
else_range = SourceRange::ContinuationOf(then_range);
|
||||
else_statement = ParseScopedStatement(labels, CHECK_OK);
|
||||
else_range.end = scanner_->location().end_pos;
|
||||
} else {
|
||||
else_statement = factory()->NewEmptyStatement(kNoSourcePosition);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ TestCoverage("Partial coverage collection",
|
||||
}(); // 0400
|
||||
`,
|
||||
[{"start":52,"end":153,"count":0},
|
||||
{"start":127,"end":152,"count":1}]
|
||||
{"start":121,"end":152,"count":1}]
|
||||
);
|
||||
|
||||
%DebugToggleBlockCoverage(false);
|
||||
|
@ -38,20 +38,23 @@ function f(x) { // 0050
|
||||
} // 0550
|
||||
f(42); // 0600
|
||||
f(43); // 0650
|
||||
if (true) { // 0700
|
||||
const foo = 'bar'; // 0750
|
||||
} else { // 0800
|
||||
const bar = 'foo'; // 0850
|
||||
} // 0900
|
||||
`,
|
||||
[{"start":0,"end":699,"count":1},
|
||||
[{"start":0,"end":949,"count":1},
|
||||
{"start":801,"end":901,"count":0},
|
||||
{"start":0,"end":15,"count":11},
|
||||
{"start":50,"end":551,"count":2},
|
||||
{"start":115,"end":203,"count":1},
|
||||
{"start":167,"end":171,"count":0},
|
||||
{"start":265,"end":273,"count":1},
|
||||
{"start":279,"end":287,"count":1},
|
||||
{"start":315,"end":319,"count":1},
|
||||
{"start":325,"end":329,"count":1},
|
||||
{"start":265,"end":287,"count":1},
|
||||
{"start":315,"end":329,"count":1},
|
||||
{"start":363,"end":367,"count":0},
|
||||
{"start":413,"end":417,"count":0},
|
||||
{"start":472,"end":476,"count":0}]
|
||||
|
||||
{"start":466,"end":476,"count":0}]
|
||||
);
|
||||
|
||||
TestCoverage(
|
||||
@ -82,7 +85,7 @@ TestCoverage(
|
||||
`,
|
||||
[{"start":0,"end":249,"count":1},
|
||||
{"start":1,"end":201,"count":1},
|
||||
{"start":124,"end":129,"count":0}]
|
||||
{"start":118,"end":129,"count":0}]
|
||||
);
|
||||
|
||||
TestCoverage(
|
||||
@ -109,7 +112,7 @@ function g() {} // 0000
|
||||
{"start":330,"end":334,"count":0},
|
||||
{"start":431,"end":503,"count":12},
|
||||
{"start":470,"end":474,"count":4},
|
||||
{"start":480,"end":484,"count":8}]
|
||||
{"start":474,"end":484,"count":8}]
|
||||
);
|
||||
|
||||
TestCoverage(
|
||||
|
Loading…
Reference in New Issue
Block a user