@@ -1330,7 +1330,7 @@ export function createSourceFile(
1330
1330
languageVersionOrOptions: ScriptTarget | CreateSourceFileOptions,
1331
1331
setParentNodes = false,
1332
1332
scriptKind?: ScriptKind,
1333
- skipJSDoc ?: boolean,
1333
+ skipNonSemanticJSDoc ?: boolean,
1334
1334
): SourceFile {
1335
1335
tracing?.push(tracing.Phase.Parse, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true);
1336
1336
performance.mark("beforeParse");
@@ -1343,14 +1343,14 @@ export function createSourceFile(
1343
1343
impliedNodeFormat: format,
1344
1344
} = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : ({ languageVersion: languageVersionOrOptions } as CreateSourceFileOptions);
1345
1345
if (languageVersion === ScriptTarget.JSON) {
1346
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, ScriptKind.JSON, noop, skipJSDoc );
1346
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, ScriptKind.JSON, noop, skipNonSemanticJSDoc );
1347
1347
}
1348
1348
else {
1349
1349
const setIndicator = format === undefined ? overrideSetExternalModuleIndicator : (file: SourceFile) => {
1350
1350
file.impliedNodeFormat = format;
1351
1351
return (overrideSetExternalModuleIndicator || setExternalModuleIndicator)(file);
1352
1352
};
1353
- result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind, setIndicator, skipJSDoc );
1353
+ result = Parser.parseSourceFile(fileName, sourceText, languageVersion, /*syntaxCursor*/ undefined, setParentNodes, scriptKind, setIndicator, skipNonSemanticJSDoc );
1354
1354
}
1355
1355
perfLogger?.logStopParseSourceFile();
1356
1356
@@ -1590,7 +1590,7 @@ namespace Parser {
1590
1590
setParentNodes = false,
1591
1591
scriptKind?: ScriptKind,
1592
1592
setExternalModuleIndicatorOverride?: (file: SourceFile) => void,
1593
- skipJSDoc ?: boolean,
1593
+ skipNonSemanticJSDoc ?: boolean,
1594
1594
): SourceFile {
1595
1595
scriptKind = ensureScriptKind(fileName, scriptKind);
1596
1596
if (scriptKind === ScriptKind.JSON) {
@@ -1605,10 +1605,10 @@ namespace Parser {
1605
1605
return result;
1606
1606
}
1607
1607
1608
- skipJSDoc = !!skipJSDoc && scriptKind !== ScriptKind.JS && scriptKind !== ScriptKind.JSX;
1609
- initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind, skipJSDoc );
1608
+ skipNonSemanticJSDoc = !!skipNonSemanticJSDoc && scriptKind !== ScriptKind.JS && scriptKind !== ScriptKind.JSX;
1609
+ initializeState(fileName, sourceText, languageVersion, syntaxCursor, scriptKind, skipNonSemanticJSDoc );
1610
1610
1611
- const result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicatorOverride || setExternalModuleIndicator, skipJSDoc );
1611
+ const result = parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicatorOverride || setExternalModuleIndicator, skipNonSemanticJSDoc );
1612
1612
1613
1613
clearState();
1614
1614
@@ -1617,7 +1617,7 @@ namespace Parser {
1617
1617
1618
1618
export function parseIsolatedEntityName(content: string, languageVersion: ScriptTarget): EntityName | undefined {
1619
1619
// Choice of `isDeclarationFile` should be arbitrary
1620
- initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, ScriptKind.JS, /*skipJSDoc */ false);
1620
+ initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, ScriptKind.JS, /*skipNonSemanticJSDoc */ false);
1621
1621
// Prime the scanner.
1622
1622
nextToken();
1623
1623
const entityName = parseEntityName(/*allowReservedWords*/ true);
@@ -1627,7 +1627,7 @@ namespace Parser {
1627
1627
}
1628
1628
1629
1629
export function parseJsonText(fileName: string, sourceText: string, languageVersion: ScriptTarget = ScriptTarget.ES2015, syntaxCursor?: IncrementalParser.SyntaxCursor, setParentNodes = false): JsonSourceFile {
1630
- initializeState(fileName, sourceText, languageVersion, syntaxCursor, ScriptKind.JSON, /*skipJSDoc */ false);
1630
+ initializeState(fileName, sourceText, languageVersion, syntaxCursor, ScriptKind.JSON, /*skipNonSemanticJSDoc */ false);
1631
1631
sourceFlags = contextFlags;
1632
1632
1633
1633
// Prime the scanner.
@@ -1715,7 +1715,7 @@ namespace Parser {
1715
1715
return result;
1716
1716
}
1717
1717
1718
- function initializeState(_fileName: string, _sourceText: string, _languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor | undefined, _scriptKind: ScriptKind, _skipJSDoc : boolean) {
1718
+ function initializeState(_fileName: string, _sourceText: string, _languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor | undefined, _scriptKind: ScriptKind, _skipNonSemanticJSDoc : boolean) {
1719
1719
NodeConstructor = objectAllocator.getNodeConstructor();
1720
1720
TokenConstructor = objectAllocator.getTokenConstructor();
1721
1721
IdentifierConstructor = objectAllocator.getIdentifierConstructor();
@@ -1756,15 +1756,15 @@ namespace Parser {
1756
1756
scanner.setOnError(scanError);
1757
1757
scanner.setScriptTarget(languageVersion);
1758
1758
scanner.setLanguageVariant(languageVariant);
1759
- scanner.setSkipJSDoc(_skipJSDoc );
1759
+ scanner.setSkipNonSemanticJSDoc(_skipNonSemanticJSDoc );
1760
1760
}
1761
1761
1762
1762
function clearState() {
1763
1763
// Clear out the text the scanner is pointing at, so it doesn't keep anything alive unnecessarily.
1764
1764
scanner.clearCommentDirectives();
1765
1765
scanner.setText("");
1766
1766
scanner.setOnError(undefined);
1767
- scanner.setSkipJSDoc (false);
1767
+ scanner.setSkipNonSemanticJSDoc (false);
1768
1768
1769
1769
// Clear any data. We don't want to accidentally hold onto it for too long.
1770
1770
sourceText = undefined!;
@@ -1781,7 +1781,7 @@ namespace Parser {
1781
1781
topLevel = true;
1782
1782
}
1783
1783
1784
- function parseSourceFileWorker(languageVersion: ScriptTarget, setParentNodes: boolean, scriptKind: ScriptKind, setExternalModuleIndicator: (file: SourceFile) => void, skipJSDoc : boolean): SourceFile {
1784
+ function parseSourceFileWorker(languageVersion: ScriptTarget, setParentNodes: boolean, scriptKind: ScriptKind, setExternalModuleIndicator: (file: SourceFile) => void, skipNonSemanticJSDoc : boolean): SourceFile {
1785
1785
const isDeclarationFile = isDeclarationFileName(fileName);
1786
1786
if (isDeclarationFile) {
1787
1787
contextFlags |= NodeFlags.Ambient;
@@ -1808,7 +1808,7 @@ namespace Parser {
1808
1808
sourceFile.identifierCount = identifierCount;
1809
1809
sourceFile.identifiers = identifiers;
1810
1810
sourceFile.parseDiagnostics = attachFileToDiagnostics(parseDiagnostics, sourceFile);
1811
- sourceFile.jsdocSkipped = skipJSDoc ;
1811
+ sourceFile.skipNonSemanticJSDoc = skipNonSemanticJSDoc ;
1812
1812
if (jsDocDiagnostics) {
1813
1813
sourceFile.jsDocDiagnostics = attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
1814
1814
}
@@ -8690,7 +8690,7 @@ namespace Parser {
8690
8690
8691
8691
export namespace JSDocParser {
8692
8692
export function parseJSDocTypeExpressionForTests(content: string, start: number | undefined, length: number | undefined): { jsDocTypeExpression: JSDocTypeExpression; diagnostics: Diagnostic[]; } | undefined {
8693
- initializeState("file.js", content, ScriptTarget.Latest, /*syntaxCursor*/ undefined, ScriptKind.JS, /*skipJSDoc */ false);
8693
+ initializeState("file.js", content, ScriptTarget.Latest, /*syntaxCursor*/ undefined, ScriptKind.JS, /*skipNonSemanticJSDoc */ false);
8694
8694
scanner.setText(content, start, length);
8695
8695
currentToken = scanner.scan();
8696
8696
const jsDocTypeExpression = parseJSDocTypeExpression();
@@ -8740,7 +8740,7 @@ namespace Parser {
8740
8740
}
8741
8741
8742
8742
export function parseIsolatedJSDocComment(content: string, start: number | undefined, length: number | undefined): { jsDoc: JSDoc; diagnostics: Diagnostic[]; } | undefined {
8743
- initializeState("", content, ScriptTarget.Latest, /*syntaxCursor*/ undefined, ScriptKind.JS, /*skipJSDoc */ false);
8743
+ initializeState("", content, ScriptTarget.Latest, /*syntaxCursor*/ undefined, ScriptKind.JS, /*skipNonSemanticJSDoc */ false);
8744
8744
const jsDoc = doInsideOfContext(NodeFlags.JSDoc, () => parseJSDocCommentWorker(start, length));
8745
8745
8746
8746
const sourceFile = { languageVariant: LanguageVariant.Standard, text: content } as SourceFile;
@@ -9808,7 +9808,7 @@ namespace IncrementalParser {
9808
9808
if (sourceFile.statements.length === 0) {
9809
9809
// If we don't have any statements in the current source file, then there's no real
9810
9810
// way to incrementally parse. So just do a full parse instead.
9811
- return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator, sourceFile.jsdocSkipped );
9811
+ return Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, /*syntaxCursor*/ undefined, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator, sourceFile.skipNonSemanticJSDoc );
9812
9812
}
9813
9813
9814
9814
// Make sure we're not trying to incrementally update a source file more than once. Once
@@ -9871,7 +9871,7 @@ namespace IncrementalParser {
9871
9871
// inconsistent tree. Setting the parents on the new tree should be very fast. We
9872
9872
// will immediately bail out of walking any subtrees when we can see that their parents
9873
9873
// are already correct.
9874
- const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator, sourceFile.jsdocSkipped );
9874
+ const result = Parser.parseSourceFile(sourceFile.fileName, newText, sourceFile.languageVersion, syntaxCursor, /*setParentNodes*/ true, sourceFile.scriptKind, sourceFile.setExternalModuleIndicator, sourceFile.skipNonSemanticJSDoc );
9875
9875
result.commentDirectives = getNewCommentDirectives(
9876
9876
sourceFile.commentDirectives,
9877
9877
result.commentDirectives,
0 commit comments