fix(compiler-cli): capture metadata for undecorated fields#63904
fix(compiler-cli): capture metadata for undecorated fields#63904crisbeto wants to merge 3 commits intoangular:mainfrom
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.
LGTM, non-blocking comments
| * 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.
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.
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.