From 81734cf7b644f0b3117d71a4285d430c8ac1955a Mon Sep 17 00:00:00 2001 From: Chuck Jazdzewski Date: Thu, 22 Jun 2017 10:36:42 -0700 Subject: [PATCH] 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. --- packages/compiler/src/aot/compiler.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/compiler/src/aot/compiler.ts b/packages/compiler/src/aot/compiler.ts index e5ae0d0779..5295a52548 100644 --- a/packages/compiler/src/aot/compiler.ts +++ b/packages/compiler/src/aot/compiler.ts @@ -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;