Skip to content

Commit

Permalink
[JS] Fix Parser.getSourceName returning undefined
Browse files Browse the repository at this point in the history
Parser.getSourceName was expecting a field `sourceName` on `TokenStream`,
but that doesn't exist on any `TokenStream` implementation. This commit
fixes the bug by calling `getSourceName`, which *is* defined on
`BufferedTokenStream`.

This commit also removes some nearby commented-out code that didn't make
any sense.

Signed-off-by: Phlosioneer <mattmdrr2@gmail.com>
  • Loading branch information
Phlosioneer authored and ericvergnaud committed Apr 6, 2024
1 parent 6628b00 commit b486ce7
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions runtime/JavaScript/src/antlr4/Parser.js
Expand Up @@ -603,14 +603,8 @@ export default class Parser extends Recognizer {
}
}

/*
" printer = function() {\r\n" +
" this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
" this.print = function(s) { document.getElementById('output') += s; }\r\n" +
" };\r\n" +
*/
getSourceName() {
return this._input.sourceName;
return this._input.getSourceName();
}

/**
Expand Down

0 comments on commit b486ce7

Please sign in to comment.