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

Function getLabelReferencesInNode

internal/ls/findallreferences.go:1369–1380  ·  view source on GitHub ↗
(container *ast.Node, targetLabel *ast.Node)

Source from the content-addressed store, hash-verified

1367}
1368
1369func getLabelReferencesInNode(container *ast.Node, targetLabel *ast.Node) []*SymbolAndEntries {
1370 sourceFile := ast.GetSourceFileOfNode(container)
1371 labelName := targetLabel.Text()
1372 references := core.MapNonNil(getPossibleSymbolReferenceNodes(sourceFile, labelName, container), func(node *ast.Node) *ReferenceEntry {
1373 // Only pick labels that are either the target label, or have a target that is the target label
1374 if node == targetLabel.AsNode() || (isJumpStatementTarget(node) && getTargetLabel(node, labelName) == targetLabel) {
1375 return newNodeEntry(node)
1376 }
1377 return nil
1378 })
1379 return []*SymbolAndEntries{NewSymbolAndEntries(definitionKindLabel, targetLabel, nil, references)}
1380}
1381
1382func getReferencesForThisKeyword(thisOrSuperKeyword *ast.Node, sourceFiles []*ast.SourceFile) []*SymbolAndEntries {
1383 searchSpaceNode := ast.GetThisContainer(thisOrSuperKeyword, false /*includeArrowFunctions*/, false /*includeClassComputedPropertyName*/)

Callers 1

Calls 9

GetSourceFileOfNodeFunction · 0.92
MapNonNilFunction · 0.92
isJumpStatementTargetFunction · 0.85
getTargetLabelFunction · 0.85
newNodeEntryFunction · 0.85
NewSymbolAndEntriesFunction · 0.85
TextMethod · 0.65
AsNodeMethod · 0.65

Tested by

no test coverage detected