|
8 | 8 |
|
9 | 9 | import {DtsMetadataReader} from '@angular/compiler-cli/src/ngtsc/metadata'; |
10 | 10 | import {TypeScriptReflectionHost} from '@angular/compiler-cli/src/ngtsc/reflection'; |
11 | | -import {confirmAsSerializable, Serializable} from '../helpers/serializable'; |
| 11 | +import {confirmAsSerializable} from '../helpers/serializable'; |
12 | 12 | import {TsurgeComplexMigration} from '../migration'; |
13 | 13 | import {ProgramInfo} from '../program_info'; |
14 | 14 | import {Replacement, TextUpdate} from '../replacement'; |
@@ -52,39 +52,28 @@ export class OutputMigration extends TsurgeComplexMigration<AnalysisUnit, Global |
52 | 52 | return confirmAsSerializable(discoveredOutputs); |
53 | 53 | } |
54 | 54 |
|
55 | | - override async combine(unitA: AnalysisUnit, unitB: AnalysisUnit) { |
56 | | - const merged: AnalysisUnit = {}; |
| 55 | + override async merge(data: AnalysisUnit[]) { |
| 56 | + const merged: GlobalMetadata = {}; |
57 | 57 |
|
58 | | - // Merge information from two compilation units. Mark |
| 58 | + // Merge information from all compilation units. Mark |
59 | 59 | // outputs that cannot be migrated due to seen problematic usages. |
60 | | - for (const unit of [unitA, unitB]) { |
| 60 | + for (const unit of data) { |
61 | 61 | for (const [idStr, info] of Object.entries(unit)) { |
62 | 62 | const id = idStr as OutputID; |
63 | 63 | const existing = merged[id]; |
64 | 64 |
|
65 | 65 | if (existing === undefined) { |
66 | | - merged[id] = {seenProblematicUsage: info.seenProblematicUsage}; |
67 | | - } else if (!existing.seenProblematicUsage && info.seenProblematicUsage) { |
68 | | - merged[id].seenProblematicUsage = true; |
| 66 | + merged[id] = {canBeMigrated: info.seenProblematicUsage === false}; |
| 67 | + } else if (existing.canBeMigrated && info.seenProblematicUsage) { |
| 68 | + merged[id].canBeMigrated = false; |
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
72 | 72 |
|
| 73 | + // merge units into global metadata. |
73 | 74 | return confirmAsSerializable(merged); |
74 | 75 | } |
75 | 76 |
|
76 | | - override async globalMeta(combinedData: AnalysisUnit) { |
77 | | - const globalMeta: GlobalMetadata = {}; |
78 | | - |
79 | | - for (const [idStr, info] of Object.entries(combinedData)) { |
80 | | - globalMeta[idStr as OutputID] = { |
81 | | - canBeMigrated: info.seenProblematicUsage === false, |
82 | | - }; |
83 | | - } |
84 | | - |
85 | | - return confirmAsSerializable(globalMeta); |
86 | | - } |
87 | | - |
88 | 77 | override async migrate(globalAnalysisData: GlobalMetadata, info: ProgramInfo) { |
89 | 78 | const program = info.program; |
90 | 79 | const typeChecker = program.getTypeChecker(); |
|
0 commit comments