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

Function goEmbeddedTypeName

src/extraction/languages/go.ts:61–67  ·  view source on GitHub ↗
(type: SyntaxNode | null | undefined, source: string)

Source from the content-addressed store, hash-verified

59 * which an embedding brings in like any type's from outside the index.
60 */
61export function goEmbeddedTypeName(type: SyntaxNode | null | undefined, source: string): SyntaxNode | undefined {
62 if (type?.type === 'generic_type') type = getChildByField(type, 'type');
63 if (type?.type === 'qualified_type') return getChildByField(type, 'name') ?? undefined;
64 if (type?.type !== 'type_identifier') return undefined;
65 const name = getNodeText(type, source);
66 return name === 'error' || !GO_PREDECLARED_TYPES.has(name) ? type : undefined;
67}
68
69/**
70 * The names a type name written bare inside a Go type declaration can mean

Callers 1

extractInheritanceMethod · 0.90

Calls 3

getChildByFieldFunction · 0.90
getNodeTextFunction · 0.90
hasMethod · 0.80

Tested by

no test coverage detected