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

Function collectExternalModuleReferences

internal/parser/references.go:11–22  ·  view source on GitHub ↗
(file *ast.SourceFile)

Source from the content-addressed store, hash-verified

9)
10
11func collectExternalModuleReferences(file *ast.SourceFile) {
12 for _, node := range file.Statements.Nodes {
13 collectModuleReferences(file, node, false /*inAmbientModule*/)
14 }
15
16 if file.Flags&ast.NodeFlagsPossiblyContainsDynamicImport != 0 || ast.IsInJSFile(file.AsNode()) {
17 ast.ForEachDynamicImportOrRequireCall(file /*includeTypeSpaceImports*/, true /*requireStringLiteralLikeArgument*/, true, func(node *ast.Node, moduleSpecifier *ast.Expression) bool {
18 ast.SetImportsOfSourceFile(file, append(file.Imports(), moduleSpecifier))
19 return false
20 })
21 }
22}
23
24func collectModuleReferences(file *ast.SourceFile, node *ast.Statement, inAmbientModule bool) {
25 if ast.IsAnyImportOrReExport(node) {

Callers 1

parseSourceFileWorkerMethod · 0.85

Calls 7

IsInJSFileFunction · 0.92
SetImportsOfSourceFileFunction · 0.92
collectModuleReferencesFunction · 0.85
AsNodeMethod · 0.65
ImportsMethod · 0.65
appendFunction · 0.50

Tested by

no test coverage detected