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

Dont't ignore filtering by types in function getTokens. #409

Closed
wants to merge 1 commit into from

Conversation

nmarusov
Copy link

As I understand, getTokens must return filtered tokens even though the full range of indices has been passed. Now the filtering is skipped.

@codecov-io
Copy link

Codecov Report

Merging #409 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #409      +/-   ##
=========================================
+ Coverage   74.99%     75%   +0.01%     
=========================================
  Files         153     153              
  Lines       10081   10079       -2     
  Branches     1589    1588       -1     
=========================================
  Hits         7560    7560              
+ Misses       1965    1962       -3     
- Partials      556     557       +1

@@ -308,10 +308,6 @@ export class BufferedTokenStream implements TokenStream {
throw new RangeError("start " + start + " or stop " + stop + " not in 0.." + (this.tokens.length - 1));
}

if (start === 0 && stop === this.tokens.length - 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 So this was supposed to handle the case of this method:

https://github.com/tunnelvisionlabs/antlr4/blob/be017394a160f85d201f55aac962090e30f1b4b6/runtime/Java/src/org/antlr/v4/runtime/BufferedTokenStream.java#L267

It looks like I messed this up a bit in a few ways. Let me add back the explicit overloads and implement this in a manner more consistent with patterns followed later in the porting work.

@sharwell
Copy link
Member

Great catch @nmarusov!

@sharwell
Copy link
Member

sharwell commented Mar 1, 2019

@nmarusov I fixed this now in #410, thank you again!

@sharwell sharwell closed this Mar 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants