@@ -1401,18 +1401,20 @@ export function parseJSDocTypeExpressionForTests(content: string, start?: number
1401
1401
// parser instances can actually be expensive enough to impact us on projects with many source
1402
1402
// files.
1403
1403
namespace Parser {
1404
+ /* eslint-disable no-var */
1405
+
1404
1406
// Share a single scanner across all calls to parse a source file. This helps speed things
1405
1407
// 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);
1407
1409
1408
- const disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext;
1410
+ var disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext;
1409
1411
1410
1412
// 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;
1416
1418
1417
1419
function countNode(node: Node) {
1418
1420
nodeCount++;
@@ -1421,17 +1423,16 @@ namespace Parser {
1421
1423
1422
1424
// Rather than using `createBaseNodeFactory` here, we establish a `BaseNodeFactory` that closes over the
1423
1425
// constructors above, which are reset each time `initializeState` is called.
1424
- const baseNodeFactory: BaseNodeFactory = {
1426
+ var baseNodeFactory: BaseNodeFactory = {
1425
1427
createBaseSourceFileNode: kind => countNode(new SourceFileConstructor(kind, /*pos*/ 0, /*end*/ 0)),
1426
1428
createBaseIdentifierNode: kind => countNode(new IdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)),
1427
1429
createBasePrivateIdentifierNode: kind => countNode(new PrivateIdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)),
1428
1430
createBaseTokenNode: kind => countNode(new TokenConstructor(kind, /*pos*/ 0, /*end*/ 0)),
1429
1431
createBaseNode: kind => countNode(new NodeConstructor(kind, /*pos*/ 0, /*end*/ 0))
1430
1432
};
1431
1433
1432
- const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory);
1434
+ var factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory);
1433
1435
1434
- /* eslint-disable no-var */
1435
1436
var fileName: string;
1436
1437
var sourceFlags: NodeFlags;
1437
1438
var sourceText: string;
0 commit comments