Arrow function: name on parent variable_declarator/field_definition, or the key of an object-literal property — the Zustand "actions returned from a factory" pattern, `{ addItem: (...) => {...} }` (#341).
| 4009 | // key of an object-literal property — the Zustand "actions returned from a |
| 4010 | // factory" pattern, `{ addItem: (...) => {...} }` (#341). |
| 4011 | static TSNode resolve_arrow_func_name(TSNode child) { |
| 4012 | TSNode parent = ts_node_parent(child); |
| 4013 | if (!ts_node_is_null(parent)) { |
| 4014 | const char *pk = ts_node_type(parent); |
| 4015 | if (strcmp(pk, "field_definition") == 0) { |
| 4016 | return ts_node_child_by_field_name(parent, TS_FIELD("property")); |
| 4017 | } |
| 4018 | if (strcmp(pk, "public_field_definition") == 0 || strcmp(pk, "variable_declarator") == 0) { |
| 4019 | return ts_node_child_by_field_name(parent, TS_FIELD("name")); |
| 4020 | } |
| 4021 | if (strcmp(pk, "pair") == 0) { |
| 4022 | // Object-literal property `key: () => {...}` → name is the key. |
| 4023 | return ts_node_child_by_field_name(parent, TS_FIELD("key")); |
| 4024 | } |
| 4025 | } |
| 4026 | TSNode null_node = {0}; |
| 4027 | return null_node; |
| 4028 | } |
| 4029 | |
| 4030 | // Try to extract method name from a node, with language-specific fallbacks. |
| 4031 | static TSNode resolve_method_name(TSNode child, CBMLanguage lang) { |
no outgoing calls
no test coverage detected