Skip to content

Commit 450cfe1

Browse files
Switch let to var in the parser for top-levelish variables.
1 parent 84b8483 commit 450cfe1

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

src/compiler/parser.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,24 +1431,25 @@ namespace Parser {
14311431

14321432
const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory);
14331433

1434-
let fileName: string;
1435-
let sourceFlags: NodeFlags;
1436-
let sourceText: string;
1437-
let languageVersion: ScriptTarget;
1438-
let scriptKind: ScriptKind;
1439-
let languageVariant: LanguageVariant;
1440-
let parseDiagnostics: DiagnosticWithDetachedLocation[];
1441-
let jsDocDiagnostics: DiagnosticWithDetachedLocation[];
1442-
let syntaxCursor: IncrementalParser.SyntaxCursor | undefined;
1443-
1444-
let currentToken: SyntaxKind;
1445-
let nodeCount: number;
1446-
let identifiers: Map<string, string>;
1447-
let identifierCount: number;
1448-
1449-
let parsingContext: ParsingContext;
1450-
1451-
let notParenthesizedArrow: Set<number> | undefined;
1434+
/* eslint-disable no-var */
1435+
var fileName: string;
1436+
var sourceFlags: NodeFlags;
1437+
var sourceText: string;
1438+
var languageVersion: ScriptTarget;
1439+
var scriptKind: ScriptKind;
1440+
var languageVariant: LanguageVariant;
1441+
var parseDiagnostics: DiagnosticWithDetachedLocation[];
1442+
var jsDocDiagnostics: DiagnosticWithDetachedLocation[];
1443+
var syntaxCursor: IncrementalParser.SyntaxCursor | undefined;
1444+
1445+
var currentToken: SyntaxKind;
1446+
var nodeCount: number;
1447+
var identifiers: Map<string, string>;
1448+
var identifierCount: number;
1449+
1450+
var parsingContext: ParsingContext;
1451+
1452+
var notParenthesizedArrow: Set<number> | undefined;
14521453

14531454
// Flags that dictate what parsing context we're in. For example:
14541455
// Whether or not we are in strict parsing mode. All that changes in strict parsing mode is
@@ -1496,10 +1497,10 @@ namespace Parser {
14961497
// Note: it should not be necessary to save/restore these flags during speculative/lookahead
14971498
// parsing. These context flags are naturally stored and restored through normal recursive
14981499
// descent parsing and unwinding.
1499-
let contextFlags: NodeFlags;
1500+
var contextFlags: NodeFlags;
15001501

15011502
// Indicates whether we are currently parsing top-level statements.
1502-
let topLevel = true;
1503+
var topLevel = true;
15031504

15041505
// Whether or not we've had a parse error since creating the last AST node. If we have
15051506
// encountered an error, it will be stored on the next AST node we create. Parse errors
@@ -1528,7 +1529,8 @@ namespace Parser {
15281529
//
15291530
// Note: any errors at the end of the file that do not precede a regular node, should get
15301531
// attached to the EOF token.
1531-
let parseErrorBeforeNextFinishedNode = false;
1532+
var parseErrorBeforeNextFinishedNode = false;
1533+
/* eslint-enable no-var */
15321534

15331535
export function parseSourceFile(fileName: string, sourceText: string, languageVersion: ScriptTarget, syntaxCursor: IncrementalParser.SyntaxCursor | undefined, setParentNodes = false, scriptKind?: ScriptKind, setExternalModuleIndicatorOverride?: (file: SourceFile) => void): SourceFile {
15341536
scriptKind = ensureScriptKind(fileName, scriptKind);

0 commit comments

Comments
 (0)