Skip to content

Commit

Permalink
Fix incorrect this.channel access
Browse files Browse the repository at this point in the history
nextTokenOnChannel was accessing the field `this.channel` instead of the
parameter `channel`. The buffered token stream class doesn't have a field
named `channel`, so this exhausted the token buffer instead.

The bug had not been caught because it is only called from `CommonTokenStream`
with parameter `this.channel`.

Signed-off-by: Phlosioneer <mattmdrr2@gmail.com>
  • Loading branch information
Phlosioneer authored and ericvergnaud committed Apr 1, 2024
1 parent 0d30259 commit 2244af3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/JavaScript/src/antlr4/BufferedTokenStream.js
Expand Up @@ -253,7 +253,7 @@ export default class BufferedTokenStream extends TokenStream {
return -1;
}
let token = this.tokens[i];
while (token.channel !== this.channel) {
while (token.channel !== channel) {
if (token.type === Token.EOF) {
return -1;
}
Expand Down

0 comments on commit 2244af3

Please sign in to comment.