feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -83,7 +83,7 @@ class WeakTupleMap {
let node = this;
for (let i = 0; i < args.length; i++) {
node = node._peek(args[i]);
if (node === undefined) return undefined;
if (node === undefined) return;
}
return node._getValue();
}
@@ -158,12 +158,11 @@ class WeakTupleMap {
*/
_peek(thing) {
if (isWeakKey(thing)) {
if ((this.f & 4) !== 4) return undefined;
if ((this.f & 4) !== 4) return;
return /** @type {W<T, V>} */ (this.w).get(thing);
} else {
if ((this.f & 2) !== 2) return undefined;
return /** @type {M<T, V>} */ (this.m).get(thing);
}
if ((this.f & 2) !== 2) return;
return /** @type {M<T, V>} */ (this.m).get(thing);
}
/**
@@ -190,25 +189,24 @@ class WeakTupleMap {
/** @type {W<T, V>} */
(this.w).set(thing, newNode);
return newNode;
} else {
if ((this.f & 2) !== 2) {
const newMap = new Map();
this.f |= 2;
const newNode = new WeakTupleMap();
(this.m = newMap).set(thing, newNode);
return newNode;
}
const entry =
/** @type {M<T, V>} */
(this.m).get(thing);
if (entry !== undefined) {
return entry;
}
}
if ((this.f & 2) !== 2) {
const newMap = new Map();
this.f |= 2;
const newNode = new WeakTupleMap();
/** @type {M<T, V>} */
(this.m).set(thing, newNode);
(this.m = newMap).set(thing, newNode);
return newNode;
}
const entry =
/** @type {M<T, V>} */
(this.m).get(thing);
if (entry !== undefined) {
return entry;
}
const newNode = new WeakTupleMap();
/** @type {M<T, V>} */
(this.m).set(thing, newNode);
return newNode;
}
}