-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Add a jump-table for visitEachChild #50266
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -885,6 +885,144 @@ namespace ts { | |
/* @internal */ jsDocCache?: readonly JSDocTag[]; // Cache for getJSDocTags | ||
} | ||
|
||
/* @internal */ | ||
export type HasChildren = | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens if someone adds a new syntax kind and forgets to update this? Seems like their new node might not emit its children? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK that's what would have happened in the old code too, because it'd hit the default case to just do nothing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If both this and #50225 use |
||
| Identifier | ||
| QualifiedName | ||
| ComputedPropertyName | ||
| TypeParameterDeclaration | ||
| ParameterDeclaration | ||
| Decorator | ||
| PropertySignature | ||
| PropertyDeclaration | ||
| MethodSignature | ||
| MethodDeclaration | ||
| ConstructorDeclaration | ||
| GetAccessorDeclaration | ||
| SetAccessorDeclaration | ||
| ClassStaticBlockDeclaration | ||
| CallSignatureDeclaration | ||
| ConstructSignatureDeclaration | ||
| IndexSignatureDeclaration | ||
| TypePredicateNode | ||
| TypeReferenceNode | ||
| FunctionTypeNode | ||
| ConstructorTypeNode | ||
| TypeQueryNode | ||
| TypeLiteralNode | ||
| ArrayTypeNode | ||
| TupleTypeNode | ||
| OptionalTypeNode | ||
| RestTypeNode | ||
| UnionTypeNode | ||
| IntersectionTypeNode | ||
| ConditionalTypeNode | ||
| InferTypeNode | ||
| ImportTypeNode | ||
| ImportTypeAssertionContainer | ||
| NamedTupleMember | ||
| ParenthesizedTypeNode | ||
| TypeOperatorNode | ||
| IndexedAccessTypeNode | ||
| MappedTypeNode | ||
| LiteralTypeNode | ||
| TemplateLiteralTypeNode | ||
| TemplateLiteralTypeSpan | ||
| ObjectBindingPattern | ||
| ArrayBindingPattern | ||
| BindingElement | ||
| ArrayLiteralExpression | ||
| ObjectLiteralExpression | ||
| PropertyAccessExpression | ||
| ElementAccessExpression | ||
| CallExpression | ||
| NewExpression | ||
| TaggedTemplateExpression | ||
| TypeAssertion | ||
| ParenthesizedExpression | ||
| FunctionExpression | ||
| ArrowFunction | ||
| DeleteExpression | ||
| TypeOfExpression | ||
| VoidExpression | ||
| AwaitExpression | ||
| PrefixUnaryExpression | ||
| PostfixUnaryExpression | ||
| BinaryExpression | ||
| ConditionalExpression | ||
| TemplateExpression | ||
| YieldExpression | ||
| SpreadElement | ||
| ClassExpression | ||
| ExpressionWithTypeArguments | ||
| AsExpression | ||
| NonNullExpression | ||
| MetaProperty | ||
| TemplateSpan | ||
| Block | ||
| VariableStatement | ||
| ExpressionStatement | ||
| IfStatement | ||
| DoStatement | ||
| WhileStatement | ||
| ForStatement | ||
| ForInStatement | ||
| ForOfStatement | ||
| ContinueStatement | ||
| BreakStatement | ||
| ReturnStatement | ||
| WithStatement | ||
| SwitchStatement | ||
| LabeledStatement | ||
| ThrowStatement | ||
| TryStatement | ||
| VariableDeclaration | ||
| VariableDeclarationList | ||
| FunctionDeclaration | ||
| ClassDeclaration | ||
| InterfaceDeclaration | ||
| TypeAliasDeclaration | ||
| EnumDeclaration | ||
| ModuleDeclaration | ||
| ModuleBlock | ||
| CaseBlock | ||
| NamespaceExportDeclaration | ||
| ImportEqualsDeclaration | ||
| ImportDeclaration | ||
| AssertClause | ||
| AssertEntry | ||
| ImportClause | ||
| NamespaceImport | ||
| NamespaceExport | ||
| NamedImports | ||
| ImportSpecifier | ||
| ExportAssignment | ||
| ExportDeclaration | ||
| NamedExports | ||
| ExportSpecifier | ||
| ExternalModuleReference | ||
| JsxElement | ||
| JsxSelfClosingElement | ||
| JsxOpeningElement | ||
| JsxClosingElement | ||
| JsxFragment | ||
| JsxAttribute | ||
| JsxAttributes | ||
| JsxSpreadAttribute | ||
| JsxExpression | ||
| CaseClause | ||
| DefaultClause | ||
| HeritageClause | ||
| CatchClause | ||
| PropertyAssignment | ||
| ShorthandPropertyAssignment | ||
| SpreadAssignment | ||
| EnumMember | ||
| SourceFile | ||
| PartiallyEmittedExpression | ||
| CommaListExpression | ||
; | ||
|
||
export type HasJSDoc = | ||
| ParameterDeclaration | ||
| CallSignatureDeclaration | ||
|
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 assume that if we need to update this, we'll know because some other code won't be able to compile?
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.
To add a method to
visitEachChild
(and potentiallyforEachChild
), we'd have to add the node to this union.