From 812794600de77ad54cc2beb4fed5844d59514da3 Mon Sep 17 00:00:00 2001 From: David Tymon Date: Thu, 24 Dec 2015 13:06:59 +1100 Subject: [PATCH] JS: LexerActionExecutor cached hash string name clashes with function LexerActionExecutor caches its hash string in a member called 'hashString'. However, the class also has a method with the same name which leads to unexpected results. The member has been renamed to '_hashString' to avoid the name clash. --- runtime/JavaScript/src/antlr4/atn/LexerActionExecutor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/atn/LexerActionExecutor.js b/runtime/JavaScript/src/antlr4/atn/LexerActionExecutor.js index 51e882c33..ff020a991 100644 --- a/runtime/JavaScript/src/antlr4/atn/LexerActionExecutor.js +++ b/runtime/JavaScript/src/antlr4/atn/LexerActionExecutor.js @@ -42,7 +42,7 @@ function LexerActionExecutor(lexerActions) { this.lexerActions = lexerActions === null ? [] : lexerActions; // Caches the result of {@link //hashCode} since the hash code is an element // of the performance-critical {@link LexerATNConfig//hashCode} operation. - this.hashString = lexerActions.toString(); // "".join([str(la) for la in + this._hashString = lexerActions.toString(); // "".join([str(la) for la in // lexerActions])) return this; } @@ -158,7 +158,7 @@ LexerActionExecutor.prototype.execute = function(lexer, input, startIndex) { }; LexerActionExecutor.prototype.hashString = function() { - return this.hashString; + return this._hashString; }; LexerActionExecutor.prototype.equals = function(other) { @@ -167,7 +167,7 @@ LexerActionExecutor.prototype.equals = function(other) { } else if (!(other instanceof LexerActionExecutor)) { return false; } else { - return this.hashString === other.hashString && + return this._hashString === other._hashString && this.lexerActions === other.lexerActions; } };