@@ -1401,18 +1401,20 @@ export function parseJSDocTypeExpressionForTests(content: string, start?: number
14011401// parser instances can actually be expensive enough to impact us on projects with many source
14021402// files.
14031403namespace Parser {
1404+ /* eslint-disable no-var */
1405+
14041406 // Share a single scanner across all calls to parse a source file. This helps speed things
14051407 // up by avoiding the cost of creating/compiling scanners over and over again.
1406- const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
1408+ var scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true);
14071409
1408- const disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext;
1410+ var disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext;
14091411
14101412 // capture constructors in 'initializeState' to avoid null checks
1411- let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
1412- let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
1413- let IdentifierConstructor: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier;
1414- let PrivateIdentifierConstructor: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier;
1415- let SourceFileConstructor: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile;
1413+ var NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
1414+ var TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node;
1415+ var IdentifierConstructor: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier;
1416+ var PrivateIdentifierConstructor: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier;
1417+ var SourceFileConstructor: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile;
14161418
14171419 function countNode(node: Node) {
14181420 nodeCount++;
@@ -1421,17 +1423,16 @@ namespace Parser {
14211423
14221424 // Rather than using `createBaseNodeFactory` here, we establish a `BaseNodeFactory` that closes over the
14231425 // constructors above, which are reset each time `initializeState` is called.
1424- const baseNodeFactory: BaseNodeFactory = {
1426+ var baseNodeFactory: BaseNodeFactory = {
14251427 createBaseSourceFileNode: kind => countNode(new SourceFileConstructor(kind, /*pos*/ 0, /*end*/ 0)),
14261428 createBaseIdentifierNode: kind => countNode(new IdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)),
14271429 createBasePrivateIdentifierNode: kind => countNode(new PrivateIdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)),
14281430 createBaseTokenNode: kind => countNode(new TokenConstructor(kind, /*pos*/ 0, /*end*/ 0)),
14291431 createBaseNode: kind => countNode(new NodeConstructor(kind, /*pos*/ 0, /*end*/ 0))
14301432 };
14311433
1432- const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory);
1434+ var factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory);
14331435
1434- /* eslint-disable no-var */
14351436 var fileName: string;
14361437 var sourceFlags: NodeFlags;
14371438 var sourceText: string;
0 commit comments