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

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
5 participants
@alxhub
Contributor

alxhub commented May 31, 2018

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.

@googlebot googlebot added the cla: yes label May 31, 2018

@mary-poppins

This comment has been minimized.

mary-poppins commented May 31, 2018

@mary-poppins

This comment has been minimized.

mary-poppins commented May 31, 2018

@vicb vicb added the comp: ivy label Jun 1, 2018

@alxhub alxhub requested a review from vicb Jun 7, 2018

@mary-poppins

This comment has been minimized.

mary-poppins commented Jun 7, 2018

feat(ivy): a generic visitor which allows prefixing nodes for ngtsc
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.
@mary-poppins

This comment has been minimized.

mary-poppins commented Jun 7, 2018

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(', '));

This comment has been minimized.

@vicb

vicb Jun 7, 2018

Contributor

is removing the fail() intended ?

This comment has been minimized.

@alxhub

alxhub Jun 7, 2018

Contributor

It was causing issues in g3.

@vicb

vicb approved these changes Jun 7, 2018

@mhevery

mhevery approved these changes Jun 7, 2018

@mhevery mhevery closed this in ca79e11 Jun 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment