avoid hashCode == 0

This commit is contained in:
Eric Vergnaud 2019-08-24 01:46:11 +08:00
parent 165dfa2b70
commit 3e258c5d9d
1 changed files with 4 additions and 2 deletions

View File

@ -111,11 +111,13 @@ Object.defineProperty(PredictionContextCache.prototype, "length", {
function SingletonPredictionContext(parent, returnState) {
var hashCode = 0;
if(parent !== null) {
var hash = new Hash();
if(parent !== null) {
hash.update(parent, returnState);
hashCode = hash.finish();
} else {
hash.update(1);
}
hashCode = hash.finish();
PredictionContext.call(this, hashCode);
this.parentCtx = parent;
this.returnState = returnState;