refactor(compiler): simplify the CompilerHost
used for transformers
- remove unneeded methods (`getNgCanonicalFileName`, `assumeFileExists`) - simplify moduleName <-> fileName conversion logic as we don’t need to account for `genDir` anymore. - rename `createNgCompilerHost` -> `createCompilerHost`
This commit is contained in:
@ -82,12 +82,11 @@ export class StaticReflector implements CompileReflector {
|
||||
}
|
||||
|
||||
resolveExternalReference(ref: o.ExternalReference): StaticSymbol {
|
||||
const importSymbol = this.getStaticSymbol(ref.moduleName !, ref.name !);
|
||||
const rootSymbol = this.findDeclaration(ref.moduleName !, ref.name !);
|
||||
if (importSymbol != rootSymbol) {
|
||||
this.symbolResolver.recordImportAs(rootSymbol, importSymbol);
|
||||
}
|
||||
return rootSymbol;
|
||||
const refSymbol = this.symbolResolver.getSymbolByModule(ref.moduleName !, ref.name !);
|
||||
const declarationSymbol = this.findSymbolDeclaration(refSymbol);
|
||||
this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, ref.moduleName !);
|
||||
this.symbolResolver.recordImportAs(declarationSymbol, refSymbol);
|
||||
return declarationSymbol;
|
||||
}
|
||||
|
||||
findDeclaration(moduleUrl: string, name: string, containingFile?: string): StaticSymbol {
|
||||
|
@ -172,6 +172,10 @@ export class StaticSymbolResolver {
|
||||
this.importAs.set(sourceSymbol, targetSymbol);
|
||||
}
|
||||
|
||||
recordModuleNameForFileName(fileName: string, moduleName: string) {
|
||||
this.knownFileNameToModuleNames.set(fileName, moduleName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate all information derived from the given file.
|
||||
*
|
||||
|
Reference in New Issue
Block a user