From 165dfa2b705d173ed833acaf5413295990c0d721 Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Sat, 24 Aug 2019 01:45:31 +0800 Subject: [PATCH] use same hash code whether readOnly or not --- runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js b/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js index 31b249d47..5a45f797e 100644 --- a/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js +++ b/runtime/JavaScript/src/antlr4/atn/ATNConfigSet.js @@ -175,7 +175,7 @@ ATNConfigSet.prototype.equals = function(other) { ATNConfigSet.prototype.hashCode = function() { var hash = new Hash(); - this.updateHashCode(hash); + hash.update(this.configs); return hash.finish(); }; @@ -183,13 +183,11 @@ ATNConfigSet.prototype.hashCode = function() { ATNConfigSet.prototype.updateHashCode = function(hash) { if (this.readOnly) { if (this.cachedHashCode === -1) { - var hash = new Hash(); - hash.update(this.configs); - this.cachedHashCode = hash.finish(); + this.cachedHashCode = this.hashCode(); } hash.update(this.cachedHashCode); } else { - hash.update(this.configs); + hash.update(this.hashCode()); } };