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

Function checkExportSpecifier

test/fixtures/snapshot/typescript.js:85446–85475  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

85444 }
85445 }
85446 function checkExportSpecifier(node) {
85447 checkAliasSymbol(node);
85448 if (ts.getEmitDeclarations(compilerOptions)) {
85449 collectLinkedAliases(node.propertyName || node.name, /*setVisibility*/ true);
85450 }
85451 if (!node.parent.parent.moduleSpecifier) {
85452 var exportedName = node.propertyName || node.name;
85453 // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases)
85454 var symbol = resolveName(exportedName, exportedName.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */,
85455 /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true);
85456 if (symbol && (symbol === undefinedSymbol || symbol === globalThisSymbol || symbol.declarations && isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) {
85457 error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
85458 }
85459 else {
85460 markExportAsReferenced(node);
85461 var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol);
85462 if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) {
85463 checkExpressionCached(node.propertyName || node.name);
85464 }
85465 }
85466 }
85467 else {
85468 if (ts.getESModuleInterop(compilerOptions) &&
85469 moduleKind !== ts.ModuleKind.System &&
85470 (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) &&
85471 ts.idText(node.propertyName || node.name) === "default") {
85472 checkExternalEmitHelpers(node, 131072 /* ExternalEmitHelpers.ImportDefault */);
85473 }
85474 }
85475 }
85476 function checkExportAssignment(node) {
85477 var illegalContextMessage = node.isExportEquals
85478 ? ts.Diagnostics.An_export_assignment_must_be_at_the_top_level_of_a_file_or_module_declaration

Callers

nothing calls this directly

Calls 10

checkAliasSymbolFunction · 0.85
collectLinkedAliasesFunction · 0.85
resolveNameFunction · 0.85
isGlobalSourceFileFunction · 0.85
getDeclarationContainerFunction · 0.85
markExportAsReferencedFunction · 0.85
resolveAliasFunction · 0.85
checkExpressionCachedFunction · 0.85
checkExternalEmitHelpersFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected