-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
feat(ivy): a generic visitor which allows prefixing nodes for ngtsc #24230
Conversation
You can preview 1eecee3 at https://pr24230-1eecee3.ngbuilds.io/. |
You can preview 5a09601 at https://pr24230-5a09601.ngbuilds.io/. |
You can preview 5f526e9 at https://pr24230-5f526e9.ngbuilds.io/. |
This adds ngtsc/util/src/visitor, a utility for visiting TS ASTs that can add synthetic nodes immediately prior to certain types of nodes (e.g. class declarations). It's useful to lift definitions that need to be referenced repeatedly in generated code outside of the class that defines them.
You can preview 89314da at https://pr24230-89314da.ngbuilds.io/. |
const host = new InMemoryHost(); | ||
files.forEach(file => host.writeFile(file.name, file.contents)); | ||
|
||
const rootNames = files.map(file => host.getCanonicalFileName(file.name)); | ||
const program = ts.createProgram(rootNames, {noLib: true, experimentalDecorators: true}, host); | ||
const diags = [...program.getSyntacticDiagnostics(), ...program.getSemanticDiagnostics()]; | ||
if (diags.length > 0) { | ||
fail(diags.map(diag => diag.messageText).join(', ')); |
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.
is removing the fail()
intended ?
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.
It was causing issues in g3.
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. |
This adds ngtsc/util/src/visitor, a utility for visiting TS ASTs that
can add synthetic nodes immediately prior to certain types of nodes (e.g.
class declarations). It's useful to lift definitions that need to be
referenced repeatedly in generated code outside of the class that defines
them.