Try using an unconditional no-op function.

This commit is contained in:
Daniel Rosenwasser
2022-08-09 20:41:58 +00:00
parent 85a0937352
commit 059572ab36
+3 -2
View File
@@ -97,8 +97,9 @@ namespace ts {
type ForEachChildFunction = <T>(node: any, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined) => T | undefined;
const forEachChildTable: Array<ForEachChildFunction | undefined> = [];
for (let i = 0; i < SyntaxKind.Count; i++) forEachChildTable.push(undefined);
const forEachChildTable: (ForEachChildFunction | undefined)[] = [];
const forEachChildNoOpFn: ForEachChildFunction = (_node, _cbNode, _cbNodes) => undefined;
for (let i = 0; i < SyntaxKind.Count; i++) forEachChildTable.push(forEachChildNoOpFn);
forEachChildTable[SyntaxKind.QualifiedName] = forEachQualifiedName;
forEachChildTable[SyntaxKind.TypeParameter] = forEachTypeParameter;
forEachChildTable[SyntaxKind.ShorthandPropertyAssignment] = forEachShorthandPropertyAssignment;