Skip to content

Auto-Generation of Node "Factory" Functions #3762

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

Closed
wants to merge 10 commits into from

Conversation

rbuckton
Copy link
Contributor

@rbuckton rbuckton commented Jul 7, 2015

This adds a processTypes.ts script that can be used to create a factory.generated.ts file, which contains functions for creating, updating, and testing TypeScript AST nodes.

The processTypes.ts script uses the LKG version of TypeScript to parse and reason over the src/compiler/types.ts file. Output is controlled through the use of annotation-like comments (similar to @internal):

Annotations on Interface/Type Alias declarations

  • // @kind(SyntaxKind) - Marks a type declaration as the type for the syntax kind.
  • // @factoryparam(string) - Marks a property, by name, that will be included in the parameter list for a create function, but not its associated update function.
  • // @factoryhidden(boolean) - Marks the entire type as either hidden (not included in the set of generated factory functions), or visible.
  • // @factoryhidden(string, boolean) - Marks a property, by name, that will be either hidden or visible.
  • // @factoryorder(...string) - Controls order of parameters to the create or update functions.

Annotations on a property of an interface

  • // @factoryparam - Marks the property as a parameter to the create function, but not the update function.
  • // @factoryhidden(boolean) - Marks the property as either hidden or visible.

@rbuckton rbuckton changed the title Adds an auto-generated set of factory functions for creating nodes. Auto-Generation of Node "Factory" Functions Jul 7, 2015
@rbuckton
Copy link
Contributor Author

rbuckton commented Dec 1, 2015

Closing this PR as it is out of date.

@rbuckton rbuckton closed this Dec 1, 2015
@rbuckton rbuckton deleted the generateFactoryMethods branch December 1, 2015 23:06
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants