MCPcopy Index your code
hub / github.com/nodejs/node / parseSourceFileWorker

Function parseSourceFileWorker

test/fixtures/snapshot/typescript.js:31676–31706  ·  view source on GitHub ↗
(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator)

Source from the content-addressed store, hash-verified

31674 topLevel = true;
31675 }
31676 function parseSourceFileWorker(languageVersion, setParentNodes, scriptKind, setExternalModuleIndicator) {
31677 var isDeclarationFile = isDeclarationFileName(fileName);
31678 if (isDeclarationFile) {
31679 contextFlags |= 16777216 /* NodeFlags.Ambient */;
31680 }
31681 sourceFlags = contextFlags;
31682 // Prime the scanner.
31683 nextToken();
31684 var statements = parseList(0 /* ParsingContext.SourceElements */, parseStatement);
31685 ts.Debug.assert(token() === 1 /* SyntaxKind.EndOfFileToken */);
31686 var endOfFileToken = addJSDocComment(parseTokenNode());
31687 var sourceFile = createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile, statements, endOfFileToken, sourceFlags, setExternalModuleIndicator);
31688 // A member of ReadonlyArray<T> isn't assignable to a member of T[] (and prevents a direct cast) - but this is where we set up those members so they can be readonly in the future
31689 processCommentPragmas(sourceFile, sourceText);
31690 processPragmasIntoFields(sourceFile, reportPragmaDiagnostic);
31691 sourceFile.commentDirectives = scanner.getCommentDirectives();
31692 sourceFile.nodeCount = nodeCount;
31693 sourceFile.identifierCount = identifierCount;
31694 sourceFile.identifiers = identifiers;
31695 sourceFile.parseDiagnostics = ts.attachFileToDiagnostics(parseDiagnostics, sourceFile);
31696 if (jsDocDiagnostics) {
31697 sourceFile.jsDocDiagnostics = ts.attachFileToDiagnostics(jsDocDiagnostics, sourceFile);
31698 }
31699 if (setParentNodes) {
31700 fixupParentReferences(sourceFile);
31701 }
31702 return sourceFile;
31703 function reportPragmaDiagnostic(pos, end, diagnostic) {
31704 parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, pos, end, diagnostic));
31705 }
31706 }
31707 function withJSDoc(node, hasJSDoc) {
31708 return hasJSDoc ? addJSDocComment(node) : node;
31709 }

Callers 1

parseSourceFileFunction · 0.85

Calls 11

isDeclarationFileNameFunction · 0.85
nextTokenFunction · 0.85
parseListFunction · 0.85
addJSDocCommentFunction · 0.85
parseTokenNodeFunction · 0.85
createSourceFileFunction · 0.85
processCommentPragmasFunction · 0.85
processPragmasIntoFieldsFunction · 0.85
fixupParentReferencesFunction · 0.85
assertMethod · 0.80
tokenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…