Skip to content

Commit

Permalink
Add a jump-table for visitEachChild (#50266)
Browse files Browse the repository at this point in the history
* Add a jump-table for visitEachChild

* Name each visitor function for better stack traces

* Fix node tests and some minor cleanup
  • Loading branch information
rbuckton committed Aug 18, 2022
1 parent 7bafbea commit 1592210
Show file tree
Hide file tree
Showing 2 changed files with 1,046 additions and 908 deletions.
138 changes: 138 additions & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,144 @@ namespace ts {
/* @internal */ jsDocCache?: readonly JSDocTag[]; // Cache for getJSDocTags
}

/* @internal */
export type HasChildren =
| 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
Expand Down

0 comments on commit 1592210

Please sign in to comment.