Skip to content

Commit b94b82a

Browse files
Grab function directly to avoid possible .call overhead from downlevel emit.
1 parent 6269b36 commit b94b82a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/compiler/parser.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@ namespace ts {
9797

9898
type ForEachChildFunction = <T>(node: any, cbNode: (node: Node) => T | undefined, cbNodes?: (nodes: NodeArray<Node>) => T | undefined) => T | undefined;
9999

100-
const forEachChildTable: ForEachChildFunction[] = [];
101-
const forEachChildNoOpFn: ForEachChildFunction = (_node, _cbNode, _cbNodes) => undefined;
102-
for (let i = 0; i < SyntaxKind.Count; i++) forEachChildTable.push(forEachChildNoOpFn);
100+
const forEachChildTable: (ForEachChildFunction | undefined)[] = [];
101+
for (let i = 0; i < SyntaxKind.Count; i++) forEachChildTable.push(undefined);
103102
forEachChildTable[SyntaxKind.QualifiedName] = forEachChildInQualifiedName;
104103
forEachChildTable[SyntaxKind.TypeParameter] = forEachChildInTypeParameter;
105104
forEachChildTable[SyntaxKind.ShorthandPropertyAssignment] = forEachChildInShorthandPropertyAssignment;
@@ -1088,7 +1087,8 @@ namespace ts {
10881087
return;
10891088
}
10901089

1091-
return forEachChildTable[node.kind](node, cbNode, cbNodes);
1090+
const fn = forEachChildTable[node.kind];
1091+
return fn === undefined ? undefined : fn(node, cbNode, cbNodes);
10921092
}
10931093

10941094
/** @internal */

0 commit comments

Comments
 (0)