-
Notifications
You must be signed in to change notification settings - Fork 27k
fix(compiler-cli): capture metadata for undecorated fields #63904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before.
Adds the member decorators to the map of exposed compiler symbols.
68d7ead to
41bb4f3
Compare
devversion
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, non-blocking comments
packages/compiler-cli/src/ngtsc/annotations/directive/src/shared.ts
Outdated
Show resolved
Hide resolved
| * Returns a function that can be used to extract data for the `setClassMetadata` | ||
| * calls from undecorated directive class members. | ||
| */ | ||
| export function getDirectiveUndecoratedMetadataExtractor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could have built up this data synthetically afte all signal inputs, queries, model etc are known? Mostly my hope would be to avoid having to call these tryParseX methods again?
Did you also explore re-using some of the logic from the JIT transforms out of curiosity?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The annoying part here is that it's dealing with the output AST, rather than JS data types or the TS AST. Originally I wanted to reuse the metadata we already have on inputs, but it ended up being easier to hook into the output AST construction instead.
02aa8b8 to
e22d5c1
Compare
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment. These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well. Fixes angular#57944.
e22d5c1 to
341e7d1
Compare
Reworks the logic that tracks the decorator metadata for members to do so using the output AST, rather than wrapping the TypeScript AST. This makes it easier to programmatically generate new members that weren't part of the TypeScript AST before. PR Close #63904
Adds the member decorators to the map of exposed compiler symbols. PR Close #63904
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment. These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well. Fixes #57944. PR Close #63904
Adds the member decorators to the map of exposed compiler symbols. PR Close #63904
Currently if `TestBed.overrideComponent` is used on a class that uses initializer APIs (e.g. `input()`), the initializer metadata will be wiped out, because `overrideComponent` re-compiles the class with the information set by `setClassMetadata`. `setClassMetadata` only captures decorated members at the moment. These changes introduce some logic to capture the new initializer-based APIs in `setClassMetadata` as well. Fixes #57944. PR Close #63904
…ngular#63904)" This reverts commit 4c091ab.
…lar#63904)" This reverts commit ef0ff78.
angular#63904)" This reverts commit ffe94b3.
|
@crisbeto We had to revert this due to a test breakage in G3. |
|
Will open a new PR. |
|
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. |
Currently if
TestBed.overrideComponentis used on a class that uses initializer APIs (e.g.input()), the initializer metadata will be wiped out, becauseoverrideComponentre-compiles the class with the information set bysetClassMetadata.setClassMetadataonly captures decorated members at the moment.These changes introduce some logic to capture the new initializer-based APIs in
setClassMetadataas well.Fixes #57944.