fix(compiler-cli): identify aliased initializer functions#54480
fix(compiler-cli): identify aliased initializer functions#54480crisbeto wants to merge 4 commits intoangular:mainfrom
Conversation
c7e27bd to
8f55367
Compare
There was a problem hiding this comment.
In the future I think we'll also need methods like hasImportsFor(symbol, moduleName) and hasNamespaceImportFor(moduleName) which will allow us to skip traversing the entire file even earlier. I skipped them for now since we don't need them yet, but all the information is already there.
0911967 to
1132572
Compare
1132572 to
7e8a3c5
Compare
packages/compiler-cli/src/ngtsc/imports/src/imported_symbols_tracker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/imports/src/imported_symbols_tracker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/imports/src/imported_symbols_tracker.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
At this point we have so many trackers 😄 local compilation, deferred etc
Fixes that initializer functions weren't being recognized if they are aliased (e.g. `import {model as alias} from '@angular/core';`).
To do this efficiently, I had to introduce the `ImportedSymbolsTracker` which scans the top-level imports of a file and allows them to be checked quickly, without having to go through the type checker. It will be useful in the future when verifying that that initializer APIs aren't used in unexpected places.
I've also introduced tests specifically for the `tryParseInitializerApiMember` function so that we can test it in isolation instead of going through the various functions that call into it.
7e8a3c5 to
096bbd2
Compare
|
This PR was merged into the repository by commit f04ecc0. |
Fixes that initializer functions weren't being recognized if they are aliased (e.g. `import {model as alias} from '@angular/core';`).
To do this efficiently, I had to introduce the `ImportedSymbolsTracker` which scans the top-level imports of a file and allows them to be checked quickly, without having to go through the type checker. It will be useful in the future when verifying that that initializer APIs aren't used in unexpected places.
I've also introduced tests specifically for the `tryParseInitializerApiMember` function so that we can test it in isolation instead of going through the various functions that call into it.
PR Close #54480
…gular#54480)" This reverts commit f04ecc0.
|
Rolled back due to breakage in g3. In summary, |
|
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. |
Fixes that initializer functions weren't being recognized if they are aliased (e.g.
import {model as alias} from '@angular/core';).To do this efficiently, I had to introduce the
ImportedSymbolsTrackerwhich scans the top-level imports of a file and allows them to be checked quickly, without having to go through the type checker. It will also be useful in the future when verifying that that initializer APIs aren't used in unexpected places.I've also introduced tests specifically for the
tryParseInitializerApiMemberfunction so that we can test it in isolation instead of going through the various functions that call into it.