feat: refactoring project
This commit is contained in:
40
node_modules/webpack/lib/util/WeakTupleMap.js
generated
vendored
40
node_modules/webpack/lib/util/WeakTupleMap.js
generated
vendored
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user