From b486ce73c7a5372266e7af4b89803995669ca82f Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Tue, 2 Apr 2024 16:50:25 -0400 Subject: [PATCH] [JS] Fix Parser.getSourceName returning undefined 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 --- runtime/JavaScript/src/antlr4/Parser.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/Parser.js b/runtime/JavaScript/src/antlr4/Parser.js index 032de9a74e..578ecf9519 100644 --- a/runtime/JavaScript/src/antlr4/Parser.js +++ b/runtime/JavaScript/src/antlr4/Parser.js @@ -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(); } /**