The declarations of a class body (or of the file): types, members, * imports. `depth` is the nesting of the types declared here; jv_java_type * bounds it, and so the recursion. */
| 2336 | * imports. `depth` is the nesting of the types declared here; jv_java_type |
| 2337 | * bounds it, and so the recursion. */ |
| 2338 | static void jv_java_container(jv_scan_t *s, TSNode body, const jv_frame_t *fr, int depth) { |
| 2339 | bool enum_members = jv_kind(body, "enum_body_declarations"); |
| 2340 | TSTreeCursor cur = ts_tree_cursor_new(body); |
| 2341 | if (ts_tree_cursor_goto_first_child(&cur)) { |
| 2342 | do { |
| 2343 | TSNode c = ts_tree_cursor_current_node(&cur); |
| 2344 | const char *k = ts_node_type(c); |
| 2345 | char tk = jv_java_type_kind(k); |
| 2346 | if (ts_node_is_error(c)) { |
| 2347 | jv_unplaced(s, c, true); |
| 2348 | } else if (ts_node_is_missing(c)) { |
| 2349 | continue; |
| 2350 | } else if (tk) { |
| 2351 | jv_java_type(s, c, tk, fr, depth); |
| 2352 | } else if (strcmp(k, "import_declaration") == 0) { |
| 2353 | jv_java_import(s, c); |
| 2354 | } else if (strcmp(k, "enum_body_declarations") == 0) { |
| 2355 | if (!enum_members) { |
| 2356 | jv_java_container(s, c, fr, depth); /* the same type's members */ |
| 2357 | } |
| 2358 | } else if (fr->owner == JV_NO_OWNER) { |
| 2359 | continue; /* the file itself has no members */ |
| 2360 | } else if (jv_java_is_callable(k)) { |
| 2361 | jv_java_callable(s, c, k, fr); |
| 2362 | } else if (strcmp(k, "enum_constant") == 0) { |
| 2363 | if (jv_member_ok(s, c, (TSNode){0}, false, fr->inner_depth)) { |
| 2364 | jv_member_seen(s, c, (TSNode){0}, false); |
| 2365 | jv_emit_value(s, jv_line(c), jv_field(c, "name"), "n", "-", fr); |
| 2366 | } |
| 2367 | } else if (jv_java_is_value(k)) { |
| 2368 | jv_java_fields(s, c, fr); |
| 2369 | } |
| 2370 | } while (!s->failed && ts_tree_cursor_goto_next_sibling(&cur)); |
| 2371 | } |
| 2372 | ts_tree_cursor_delete(&cur); |
| 2373 | } |
| 2374 | |
| 2375 | /* ── Kotlin ──────────────────────────────────────────────────────── */ |
| 2376 |
no test coverage detected