(node *ast.ExportSpecifierNode)
| 5532 | } |
| 5533 | |
| 5534 | func (c *Checker) checkExportSpecifier(node *ast.ExportSpecifierNode) { |
| 5535 | c.checkAliasSymbol(node) |
| 5536 | hasModuleSpecifier := node.Parent.Parent.ModuleSpecifier() != nil |
| 5537 | c.checkModuleExportName(node.PropertyName(), hasModuleSpecifier) |
| 5538 | c.checkModuleExportName(node.Name(), true /*allowStringLiteral*/) |
| 5539 | |
| 5540 | if !hasModuleSpecifier { |
| 5541 | exportedName := node.PropertyNameOrName() |
| 5542 | if exportedName.Kind == ast.KindStringLiteral { |
| 5543 | return // Skip for invalid syntax like this: export { "x" } |
| 5544 | } |
| 5545 | // find immediate value referenced by exported name (SymbolFlags.Alias is set so we don't chase down aliases) |
| 5546 | symbol := c.resolveName(exportedName, exportedName.Text(), ast.SymbolFlagsValue|ast.SymbolFlagsType|ast.SymbolFlagsNamespace|ast.SymbolFlagsAlias, nil /*nameNotFoundMessage*/, true /*isUse*/, false) |
| 5547 | if symbol != nil && (symbol == c.undefinedSymbol || symbol == c.globalThisSymbol || symbol.Declarations != nil && ast.IsGlobalSourceFile(ast.GetDeclarationContainer(symbol.Declarations[0]))) { |
| 5548 | c.error(exportedName, diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.Text()) |
| 5549 | } else { |
| 5550 | c.markLinkedReferences(node, ReferenceHintExportSpecifier, nil /*propSymbol*/, nil /*parentType*/) |
| 5551 | } |
| 5552 | } else if c.program.GetEmitModuleFormatOfFile(ast.GetSourceFileOfNode(node)) == core.ModuleKindCommonJS && |
| 5553 | ast.ModuleExportNameIsDefault(node.PropertyNameOrName()) { |
| 5554 | c.checkExternalEmitHelpers(node, ExternalEmitHelpersImportDefault) |
| 5555 | } |
| 5556 | } |
| 5557 | |
| 5558 | func (c *Checker) checkExportAssignment(node *ast.Node) { |
| 5559 | isExportEquals := node.AsExportAssignment().IsExportEquals |
no test coverage detected