(node: SyntaxNode, ctx: ExtractorContext)
| 143 | } |
| 144 | |
| 145 | function 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 | |
| 164 | function handleTypeAlias(node: SyntaxNode, ctx: ExtractorContext): boolean { |
| 165 | const typeName = getChildByField(node, 'name'); // type_name wrapper |
no test coverage detected