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

Function forEachResolution

internal/compiler/program.go:2084–2098  ·  view source on GitHub ↗
(resolutionCache map[tspath.Path]module.ModeAwareCache[T], callback func(resolution T, moduleName string, mode core.ResolutionMode, filePath tspath.Path), file *ast.SourceFile)

Source from the content-addressed store, hash-verified

2082}
2083
2084func forEachResolution[T any](resolutionCache map[tspath.Path]module.ModeAwareCache[T], callback func(resolution T, moduleName string, mode core.ResolutionMode, filePath tspath.Path), file *ast.SourceFile) {
2085 if file != nil {
2086 if resolutions, ok := resolutionCache[file.Path()]; ok {
2087 for key, resolution := range resolutions {
2088 callback(resolution, key.Name, key.Mode, file.Path())
2089 }
2090 }
2091 } else {
2092 for filePath, resolutions := range resolutionCache {
2093 for key, resolution := range resolutions {
2094 callback(resolution, key.Name, key.Mode, filePath)
2095 }
2096 }
2097 }
2098}
2099
2100var plainJSErrors = collections.NewSetFromItems(
2101 // binder errors

Calls 2

PathMethod · 0.65
callbackStruct · 0.50

Tested by

no test coverage detected