MCPcopy Create free account
hub / github.com/microsoft/typescript-go / bindSourceFileIfExternalModule

Method bindSourceFileIfExternalModule

internal/binder/binder.go:759–770  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

757}
758
759func (b *Binder) bindSourceFileIfExternalModule() {
760 b.setExportContextFlag(b.file.AsNode())
761 if ast.IsExternalOrCommonJSModule(b.file) {
762 b.bindSourceFileAsExternalModule()
763 } else if ast.IsJsonSourceFile(b.file) {
764 b.bindSourceFileAsExternalModule()
765 // Create symbol equivalent for the module.exports = {}
766 originalSymbol := b.file.Symbol
767 b.declareSymbol(ast.GetSymbolTable(&b.file.Symbol.Exports), b.file.Symbol, b.file.AsNode(), ast.SymbolFlagsProperty, ast.SymbolFlagsAll)
768 b.file.Symbol = originalSymbol
769 }
770}
771
772func (b *Binder) bindSourceFileAsExternalModule() {
773 b.bindAnonymousDeclaration(b.file.AsNode(), ast.SymbolFlagsValueModule, "\""+tspath.RemoveFileExtension(b.file.FileName())+"\"")

Callers 1

bindMethod · 0.95

Calls 7

setExportContextFlagMethod · 0.95
declareSymbolMethod · 0.95
IsJsonSourceFileFunction · 0.92
GetSymbolTableFunction · 0.92
AsNodeMethod · 0.65

Tested by

no test coverage detected