Generate invalid factory for injectable in local compilation mode#52215
Closed
pmvald wants to merge 3 commits intoangular:mainfrom
Closed
Generate invalid factory for injectable in local compilation mode#52215pmvald wants to merge 3 commits intoangular:mainfrom
pmvald wants to merge 3 commits intoangular:mainfrom
Conversation
f63612f to
fcb01be
Compare
…t `getConstructorParameters` method Currently the reflection host's `getConstructorParameters` method is not aware of the compilation mode, and it generates result mainly assuming the compilation mode is full and we have access to global type info. As a result, its result is not very suitable for local compilation usage, particularly for deciding if a symbol is imported as type or not. This change plumbs a flag `isLocalCompilation` into reflection host to make it aware of the compilation mode. Also changes made to the logic in the method `getConstructorParameters` so that in local compilation mode: - returns NO_VALUE_DECLARATION type value ref only if the type is a type parameter - returns local type value ref for any imported symbol, unless the import is type only in which case returns TYPE_ONLY_IMPORT type value ref
… with reflection host after the previous change Now the method `getConstructorDependencies` no longer needs to do any post analysis, and can rely on the reflection host's result to generate ctor params. This will automatically include invalid factories which fix the issue.
After previous commits, some `compilationMode` args in some helper functions became unused. In this change those args are cleaned up.
Contributor
|
This PR was merged into the repository by commit ae3acca. |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this pull request
Jan 23, 2024
…t `getConstructorParameters` method (angular#52215) Currently the reflection host's `getConstructorParameters` method is not aware of the compilation mode, and it generates result mainly assuming the compilation mode is full and we have access to global type info. As a result, its result is not very suitable for local compilation usage, particularly for deciding if a symbol is imported as type or not. This change plumbs a flag `isLocalCompilation` into reflection host to make it aware of the compilation mode. Also changes made to the logic in the method `getConstructorParameters` so that in local compilation mode: - returns NO_VALUE_DECLARATION type value ref only if the type is a type parameter - returns local type value ref for any imported symbol, unless the import is type only in which case returns TYPE_ONLY_IMPORT type value ref PR Close angular#52215
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this pull request
Jan 23, 2024
… with reflection host after the previous change (angular#52215) Now the method `getConstructorDependencies` no longer needs to do any post analysis, and can rely on the reflection host's result to generate ctor params. This will automatically include invalid factories which fix the issue. PR Close angular#52215
ChellappanRajan
pushed a commit
to ChellappanRajan/angular
that referenced
this pull request
Jan 23, 2024
…gular#52215) After previous commits, some `compilationMode` args in some helper functions became unused. In this change those args are cleaned up. PR Close angular#52215
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently in local compilation mode the factory is generated by moving the type expression as they are into the inject functions. This disregards the case where the type is a type param:
where symbol
Swill be undefined if moved as value to any function. Another example is type only import as directive ctor injection token:This change takes care of these cases by generating invalid factory. This requires to move this logic into the reflection host as it is no longer possible to rely on its outputs which provides limited info for our purpose.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information