refactor(compiler): add tracking comment for self-import detection

The underlying cause of #17386 needs to be investigated and as a
simple string compare should have been valid.
This commit is contained in:
Chuck Jazdzewski 2017-06-22 10:36:42 -07:00 committed by Matias Niemelä
parent 30f4fe26e0
commit 81734cf7b6
1 changed files with 5 additions and 0 deletions

View File

@ -305,6 +305,11 @@ export class AotCompiler {
const arity = this._symbolResolver.getTypeArity(symbol) || 0;
const {filePath, name, members} = this._symbolResolver.getImportAs(symbol) || symbol;
const importModule = this._symbolResolver.fileNameToModuleName(filePath, genFilePath);
// It should be good enough to compare filePath to genFilePath and if they are equal
// there is a self reference. However, ngfactory files generate to .ts but their
// symbols have .d.ts so a simple compare is insufficient. They should be canonical
// and is tracked by #17705.
const selfReference = this._symbolResolver.fileNameToModuleName(genFilePath, genFilePath);
const moduleName = importModule === selfReference ? null : importModule;