(node: Node)
| 218 | } |
| 219 | |
| 220 | function extractNodeName(node: Node): string { |
| 221 | const nameNode = maybeGetNameNode(node); |
| 222 | if (nameNode?.text) { |
| 223 | const normalized = normalizeSymbolName(nameNode.text); |
| 224 | if (normalized) { |
| 225 | return normalized; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | const compact = node.text.slice(0, 120).replace(/\s+/g, ' ').trim(); |
| 230 | const match = compact.match( |
| 231 | /(?:class|interface|enum|struct|trait|function|def|fn)\s+([A-Za-z_][\w$]*)/ |
| 232 | ); |
| 233 | if (match?.[1]) { |
| 234 | return match[1]; |
| 235 | } |
| 236 | |
| 237 | return 'anonymous'; |
| 238 | } |
| 239 | |
| 240 | function isFunctionVariableDeclarator(node: Node): boolean { |
| 241 | if (node.type !== 'variable_declarator') { |
no test coverage detected