Skip to content

Commit 324a46d

Browse files
committed
Revert "dispose code generation results after sealing the compilation"
This reverts commit cef2a8f.
1 parent 3450265 commit 324a46d

File tree

4 files changed

+2
-22
lines changed

4 files changed

+2
-22
lines changed

lib/CodeGenerationResults.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class CodeGenerationResults {
2727
* @returns {CodeGenerationResult} the CodeGenerationResult
2828
*/
2929
get(module, runtime) {
30-
this._verifyAlive();
3130
const entry = this.map.get(module);
3231
if (entry === undefined) {
3332
throw new Error(
@@ -73,7 +72,6 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
7372
* @returns {boolean} true, when we have data for this
7473
*/
7574
has(module, runtime) {
76-
this._verifyAlive();
7775
const entry = this.map.get(module);
7876
if (entry === undefined) {
7977
return false;
@@ -144,23 +142,9 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
144142
* @returns {void}
145143
*/
146144
add(module, runtime, result) {
147-
this._verifyAlive();
148145
const map = provide(this.map, module, () => new RuntimeSpecMap());
149146
map.set(runtime, result);
150147
}
151-
152-
_verifyAlive() {
153-
if (this.map === undefined) {
154-
throw new Error(
155-
"CodeGenerationResults has been accessed after its lifetime. They are no longer available after sealing the compilation."
156-
);
157-
}
158-
}
159-
160-
dispose() {
161-
this.map.clear();
162-
this.map = undefined;
163-
}
164148
}
165149

166150
module.exports = CodeGenerationResults;

lib/Compilation.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,7 +2132,6 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
21322132
this.assets = {};
21332133
this.assetsInfo.clear();
21342134
this.moduleGraph.removeAllModuleAttributes();
2135-
this.codeGenerationResults = undefined;
21362135
}
21372136

21382137
/**
@@ -2419,7 +2418,6 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o
24192418
this.unseal();
24202419
return this.seal(callback);
24212420
}
2422-
this.codeGenerationResults.dispose();
24232421
return this.hooks.afterSeal.callAsync(err => {
24242422
if (err) {
24252423
return callback(

lib/Compiler.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,12 @@ class Compiler {
359359
// e.g. move compilation specific info from Modules into ModuleGraph
360360
_cleanupLastCompilation() {
361361
if (this._lastCompilation !== undefined) {
362-
const c = this._lastCompilation;
363-
for (const module of c.modules) {
362+
for (const module of this._lastCompilation.modules) {
364363
ChunkGraph.clearChunkGraphForModule(module);
365364
ModuleGraph.clearModuleGraphForModule(module);
366365
module.cleanupForCache();
367366
}
368-
for (const chunk of c.chunks) {
367+
for (const chunk of this._lastCompilation.chunks) {
369368
ChunkGraph.clearChunkGraphForChunk(chunk);
370369
}
371370
this._lastCompilation = undefined;

types.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,6 @@ declare abstract class CodeGenerationResults {
11741174
getData(module: Module, runtime: RuntimeSpec, key: string): any;
11751175
getHash(module: Module, runtime: RuntimeSpec): any;
11761176
add(module: Module, runtime: RuntimeSpec, result: CodeGenerationResult): void;
1177-
dispose(): void;
11781177
}
11791178
type CodeValue =
11801179
| undefined

0 commit comments

Comments
 (0)