Lua: resolve anonymous function assignment name from parent assignment_statement.
| 246 | |
| 247 | // Lua: resolve anonymous function assignment name from parent assignment_statement. |
| 248 | static TSNode resolve_lua_func_name(TSNode node) { |
| 249 | TSNode parent = ts_node_parent(node); |
| 250 | if (!ts_node_is_null(parent) && strcmp(ts_node_type(parent), "expression_list") == 0) { |
| 251 | parent = ts_node_parent(parent); |
| 252 | } |
| 253 | if (ts_node_is_null(parent) || strcmp(ts_node_type(parent), "assignment_statement") != 0) { |
| 254 | TSNode null_node = {0}; |
| 255 | return null_node; |
| 256 | } |
| 257 | TSNode vars = ts_node_child_by_field_name(parent, TS_FIELD("variables")); |
| 258 | if (ts_node_is_null(vars)) { |
| 259 | uint32_t n = ts_node_child_count(parent); |
| 260 | for (uint32_t i = 0; i < n; i++) { |
| 261 | TSNode c = ts_node_child(parent, i); |
| 262 | if (strcmp(ts_node_type(c), "variable_list") == 0) { |
| 263 | vars = c; |
| 264 | break; |
| 265 | } |
| 266 | } |
| 267 | } |
| 268 | if (!ts_node_is_null(vars) && ts_node_child_count(vars) > 0) { |
| 269 | return ts_node_child(vars, 0); |
| 270 | } |
| 271 | TSNode null_node = {0}; |
| 272 | return null_node; |
| 273 | } |
| 274 | |
| 275 | // Julia: walk named children to find first identifier. |
| 276 | static TSNode resolve_julia_func_name(TSNode node) { |
no outgoing calls
no test coverage detected