(node: SyntaxNode, source: string)
| 142 | * written bare, which a linked list's `next *node` names. |
| 143 | */ |
| 144 | export function goStructFieldTypeNames(node: SyntaxNode, source: string): SyntaxNode[] { |
| 145 | const fields = getChildByField(node, 'type')?.namedChildren.find((c: SyntaxNode) => c.type === 'field_declaration_list'); |
| 146 | const names: SyntaxNode[] = []; |
| 147 | if (!fields) return names; |
| 148 | const declared = goDeclaredNames(node, source); |
| 149 | for (const field of fields.namedChildren) { |
| 150 | if (field.type !== 'field_declaration') continue; |
| 151 | let type = getChildByField(field, 'type'); |
| 152 | // Embedded: no field name (extractInheritance's test). |
| 153 | if (type && !field.namedChildren.some((c: SyntaxNode) => c.type === 'field_identifier')) { |
| 154 | type = type.type === 'generic_type' ? getChildByField(type, 'type_arguments') : null; |
| 155 | } |
| 156 | if (type) collectGoTypeNames(type, declared, source, names); |
| 157 | } |
| 158 | return names; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * The name nodes of the types a Go interface method's signature names, in |
no test coverage detected