MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / jv_java_import

Function jv_java_import

internal/cbm/doclink_jvm.c:2251–2294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2249}
2250
2251static void jv_java_import(jv_scan_t *s, TSNode decl) {
2252 if (s->lexical && (ts_node_start_byte(decl) >= s->untrusted || ts_node_has_error(decl))) {
2253 return;
2254 }
2255 bool is_static = false;
2256 bool star = false;
2257 TSNode name = {0};
2258 uint32_t cc = ts_node_child_count(decl);
2259 for (uint32_t i = 0; i < cc; i++) {
2260 TSNode ch = ts_node_child(decl, i);
2261 const char *k = ts_node_type(ch);
2262 if (strcmp(k, "static") == 0) {
2263 is_static = true;
2264 } else if (strcmp(k, "asterisk") == 0) {
2265 star = true;
2266 } else if (strcmp(k, "scoped_identifier") == 0 || strcmp(k, "identifier") == 0) {
2267 name = ch;
2268 }
2269 }
2270 char text[JV_TYPE_MAX];
2271 if (ts_node_is_null(name) ||
2272 !jv_type_name(s, ts_node_start_byte(name), ts_node_end_byte(name), text, sizeof(text))) {
2273 return;
2274 }
2275 char *dot = strrchr(text, '.');
2276 if (star) {
2277 jv_puts(&s->sb, is_static ? "I\tn\t-\t" : "I\tw\t-\t");
2278 jv_puts(&s->sb, text);
2279 } else if (!is_static) {
2280 jv_puts(&s->sb, "I\ts\t");
2281 jv_puts(&s->sb, dot ? dot + SKIP_ONE : text);
2282 jv_putc(&s->sb, '\t');
2283 jv_puts(&s->sb, text);
2284 } else if (dot) {
2285 *dot = '\0'; /* `import static a.b.C.member;`: the member of a type */
2286 jv_puts(&s->sb, "I\tm\t");
2287 jv_puts(&s->sb, dot + SKIP_ONE);
2288 jv_putc(&s->sb, '\t');
2289 jv_puts(&s->sb, text);
2290 } else {
2291 return;
2292 }
2293 jv_putc(&s->sb, '\n');
2294}
2295
2296static void jv_java_type(jv_scan_t *s, TSNode decl, char kind, const jv_frame_t *outer, int depth) {
2297 TSNode name_node = jv_field(decl, "name");

Callers 1

jv_java_containerFunction · 0.85

Calls 3

jv_type_nameFunction · 0.85
jv_putsFunction · 0.85
jv_putcFunction · 0.85

Tested by

no test coverage detected