MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / goDeclaredNames

Function goDeclaredNames

src/extraction/languages/go.ts:74–79  ·  view source on GitHub ↗

* The names a type name written bare inside a Go type declaration can mean * without naming another type: the declaration's own type parameters, and * its own name, which in a recursive type is the declaration itself.

(decl: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

72 * its own name, which in a recursive type is the declaration itself.
73 */
74function goDeclaredNames(decl: SyntaxNode, source: string): Set<string> {
75 const names = goTypeParameterNames(decl, source);
76 const nameNode = getChildByField(decl, 'name');
77 if (nameNode) names.add(getNodeText(nameNode, source));
78 return names;
79}
80
81/** The type parameters a Go type declaration declares: `T` and `K` in `type Store[T any, K comparable] …`. */
82function goTypeParameterNames(decl: SyntaxNode, source: string): Set<string> {

Callers 2

goAliasTypeNamesFunction · 0.85
goStructFieldTypeNamesFunction · 0.85

Calls 4

getChildByFieldFunction · 0.90
getNodeTextFunction · 0.90
goTypeParameterNamesFunction · 0.70
addMethod · 0.45

Tested by

no test coverage detected