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

Function getModuleInstanceStateCached

internal/ast/utilities.go:2316–2331  ·  view source on GitHub ↗
(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState)

Source from the content-addressed store, hash-verified

2314}
2315
2316func getModuleInstanceStateCached(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState {
2317 if visited == nil {
2318 visited = make(map[NodeId]ModuleInstanceState)
2319 }
2320 nodeId := GetNodeId(node)
2321 if cached, ok := visited[nodeId]; ok {
2322 if cached != ModuleInstanceStateUnknown {
2323 return cached
2324 }
2325 return ModuleInstanceStateNonInstantiated
2326 }
2327 visited[nodeId] = ModuleInstanceStateUnknown
2328 result := getModuleInstanceStateWorker(node, ancestors, visited)
2329 visited[nodeId] = result
2330 return result
2331}
2332
2333func getModuleInstanceStateWorker(node *Node, ancestors []*Node, visited map[NodeId]ModuleInstanceState) ModuleInstanceState {
2334 // A module is uninstantiated if it contains only

Calls 3

GetNodeIdFunction · 0.85
makeFunction · 0.50

Tested by

no test coverage detected