allocate ModuleGraphConnections.explanations only when needed
This commit is contained in:
parent
efe0c2e610
commit
67c2b502dd
|
@ -36,8 +36,9 @@ class ModuleGraphConnection {
|
|||
/** @type {function(): boolean} */
|
||||
this.condition = condition;
|
||||
/** @type {Set<string>} */
|
||||
this.explanations = new Set();
|
||||
this.explanations = undefined;
|
||||
if (explanation) {
|
||||
this.explanations = new Set();
|
||||
this.explanations.add(explanation);
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +62,14 @@ class ModuleGraphConnection {
|
|||
* @returns {void}
|
||||
*/
|
||||
addExplanation(explanation) {
|
||||
if (this.explanations === undefined) {
|
||||
this.explanations = new Set();
|
||||
}
|
||||
this.explanations.add(explanation);
|
||||
}
|
||||
|
||||
get explanation() {
|
||||
if (this.explanations === undefined) return "";
|
||||
return Array.from(this.explanations).join(" ");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue