| 942 | /* ── Method lookup ────────────────────────────────────────────────── */ |
| 943 | |
| 944 | const CBMRegisteredFunc *java_lookup_method(JavaLSPContext *ctx, const char *class_qn, |
| 945 | const char *method_name, int arg_count) { |
| 946 | if (!class_qn || !method_name) |
| 947 | return NULL; |
| 948 | const char *cur = class_qn; |
| 949 | const CBMRegisteredFunc *fallback = NULL; |
| 950 | for (int hops = 0; hops < JAVA_LSP_MAX_INHERIT_HOPS && cur; hops++) { |
| 951 | /* Try arg-count-aware lookup first. */ |
| 952 | const CBMRegisteredFunc *m = |
| 953 | cbm_registry_lookup_method_by_args(ctx->registry, cur, method_name, arg_count); |
| 954 | if (m) |
| 955 | return m; |
| 956 | /* Otherwise capture any name match as fallback. */ |
| 957 | if (!fallback) { |
| 958 | fallback = cbm_registry_lookup_method(ctx->registry, cur, method_name); |
| 959 | } |
| 960 | const CBMRegisteredType *rt = cbm_registry_lookup_type(ctx->registry, cur); |
| 961 | if (!rt) |
| 962 | break; |
| 963 | if (rt->embedded_types && rt->embedded_types[0]) { |
| 964 | cur = rt->embedded_types[0]; |
| 965 | } else { |
| 966 | cur = NULL; |
| 967 | } |
| 968 | } |
| 969 | return fallback; |
| 970 | } |
| 971 | |
| 972 | /* ── Method-invocation evaluation ─────────────────────────────────── */ |
| 973 |
no test coverage detected