Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ivy): correctly write cross-file references
There is a bug in the existing handling for cross-file references. Suppose there are two files, module.ts and component.ts. component.ts declares two components, one of which uses the other. In the Ivy model, this means the component will get a directives: reference to the other in its defineComponent call. That reference is generated by looking at the declared components of the module (in module.ts). However, the way ngtsc tracks this reference, it ends up comparing the identifier of the component in module.ts with the component.ts file, detecting they're not in the same file, and generating a relative import. This commit changes ngtsc to track all identifiers of a reference, including the one by which it is declared. This allows toExpression() to correctly decide that a local reference is okay in component.ts.
- Loading branch information
Showing
2 changed files
with
68 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters