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

Function handleRecordDecl

src/extraction/languages/erlang.ts:145–162  ·  view source on GitHub ↗
(node: SyntaxNode, ctx: ExtractorContext)

Source from the content-addressed store, hash-verified

143}
144
145function handleRecordDecl(node: SyntaxNode, ctx: ExtractorContext): boolean {
146 const nameNode = getChildByField(node, 'name');
147 if (!nameNode) return true;
148 const rec = ctx.createNode('struct', atomText(nameNode, ctx.source), node, {
149 docstring: getPrecedingDocstring(node, ctx.source),
150 signature: collapseWs(getNodeText(node, ctx.source)).slice(0, 300),
151 });
152 if (rec) {
153 ctx.pushScope(rec.id);
154 for (const field of node.namedChildren) {
155 if (field.type !== 'record_field') continue;
156 const fieldName = getChildByField(field, 'name');
157 if (fieldName) ctx.createNode('field', atomText(fieldName, ctx.source), field);
158 }
159 ctx.popScope();
160 }
161 return true; // field types/defaults are type-position exprs — don't descend
162}
163
164function handleTypeAlias(node: SyntaxNode, ctx: ExtractorContext): boolean {
165 const typeName = getChildByField(node, 'name'); // type_name wrapper

Callers 1

erlang.tsFile · 0.85

Calls 8

getChildByFieldFunction · 0.90
getPrecedingDocstringFunction · 0.90
getNodeTextFunction · 0.90
atomTextFunction · 0.85
collapseWsFunction · 0.85
pushScopeMethod · 0.80
popScopeMethod · 0.80
createNodeMethod · 0.65

Tested by

no test coverage detected