Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: address off by one error processing branches #118

Merged
merged 3 commits into from Oct 4, 2020
Merged

Conversation

bcoe
Copy link
Member

@bcoe bcoe commented Oct 4, 2020

Due to an off by one error when determining blocks in v8, the first character of a block range is sometimes the \n from the prior line:

In the example:

function fn() {
  return true;
  /* c8 ignore next */
  console.log('never runs');
}

fn();

One of the blocks is characters 30 - 83, or:

\n  /* c8 ignore next */\n  console.log('never runs');\n

It should not be possible for a conditional block to begin with a single character, so I believe we can address this problem by making the logic that calculates branches exclusive vs., inclusive, when it overlaps with the prior line.

Refs: bcoe/c8#254

@bcoe bcoe merged commit abe51ea into master Oct 4, 2020
@bcoe bcoe deleted the ignore-branches branch October 4, 2020 05:22
@github-actions github-actions bot mentioned this pull request Oct 4, 2020
bcoe added a commit that referenced this pull request Oct 24, 2020
This is a second attempt to fix an off-by-one error first
addressed in #118.

By setting "all" to true on the report, the placeholder report,
will be thrown out (this appears to be what caused the last regression).
bcoe added a commit that referenced this pull request Oct 24, 2020
This is a second attempt to fix an off-by-one error first
addressed in #118.

By setting "all" to true on the report, the placeholder report,
will be thrown out (this appears to be what caused the last regression).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant