Skip to content

Commit 9f5f5ab

Browse files
authored
Merge branch 'main' into fix/java-record-accessor-calls
2 parents f4c8971 + 1f9b4db commit 9f5f5ab

49 files changed

Lines changed: 3508 additions & 213 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/smoke.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Smoke invariants across the WIDEST set of GitHub-hosted runners. Builds the
22
# production source path with explicit fault-injection test seams and runs
33
# scripts/smoke-invariants.sh
4-
# (version/help, MCP initialize handshake [#513], all 14 tools invocable, malformed-
4+
# (version/help, MCP initialize handshake [#513], all registered tools invocable, malformed-
55
# input resilience, clean EOF exit, shared-lib resolution, install dry-run).
66
#
77
# Maximizing platforms is the point: ubuntu-22.04 (older glibc → AlmaLinux/#182

‎Makefile.cbm‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ PIPELINE_SRCS = \
449449
src/pipeline/pass_gitdiff.c \
450450
src/pipeline/pass_configures.c \
451451
src/pipeline/pass_configlink.c \
452+
src/pipeline/pass_doclinks.c \
452453
src/pipeline/pass_route_nodes.c \
453454
src/pipeline/pass_enrichment.c \
454455
src/pipeline/pass_envscan.c \
@@ -675,7 +676,7 @@ TEST_DISCOVER_SRCS = \
675676

676677
TEST_GRAPH_BUFFER_SRCS = tests/test_graph_buffer.c
677678

678-
TEST_PIPELINE_SRCS = tests/test_registry.c tests/test_pipeline.c tests/test_importance.c tests/test_cross_repo.c tests/test_fqn.c tests/test_route_canon.c tests/test_path_alias.c tests/test_configlink.c tests/test_infrascan.c tests/test_worker_pool.c tests/test_parallel.c tests/test_index_resilience.c tests/test_index_format.c tests/test_call_reference_contract.c tests/repro/repro_call_scope_usages.c tests/repro/repro_call_argument_usages.c tests/repro/repro_reference_precision.c tests/repro/repro_lexical_binding_precision.c tests/repro/repro_call_argument_matrix_a.c tests/repro/repro_call_argument_matrix_b.c tests/repro/repro_call_node_behaviors.c tests/repro/repro_language_registry.c tests/repro/repro_call_node_manifest.c tests/repro/repro_lsp_ordered_signatures.c tests/repro/repro_lsp_ordered_local.c tests/repro/repro_ts_overload_return_chains.c tests/repro/repro_harness_cleanup.c tests/repro/repro_runner_filter.c
679+
TEST_PIPELINE_SRCS = tests/test_registry.c tests/test_pipeline.c tests/test_importance.c tests/test_cross_repo.c tests/test_fqn.c tests/test_route_canon.c tests/test_path_alias.c tests/test_configlink.c tests/test_doclinks.c tests/test_infrascan.c tests/test_worker_pool.c tests/test_parallel.c tests/test_index_resilience.c tests/test_index_format.c tests/test_call_reference_contract.c tests/repro/repro_call_scope_usages.c tests/repro/repro_call_argument_usages.c tests/repro/repro_reference_precision.c tests/repro/repro_lexical_binding_precision.c tests/repro/repro_call_argument_matrix_a.c tests/repro/repro_call_argument_matrix_b.c tests/repro/repro_call_node_behaviors.c tests/repro/repro_language_registry.c tests/repro/repro_call_node_manifest.c tests/repro/repro_lsp_ordered_signatures.c tests/repro/repro_lsp_ordered_local.c tests/repro/repro_ts_overload_return_chains.c tests/repro/repro_harness_cleanup.c tests/repro/repro_runner_filter.c
679680

680681
TEST_WATCHER_SRCS = tests/test_watcher.c
681682

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ JSON arguments can also be piped on stdin, for tools that take arguments. A tool
704704

705705
### Edge Types
706706

707-
`CONTAINS_PACKAGE`, `CONTAINS_FOLDER`, `CONTAINS_FILE`, `DEFINES`, `DEFINES_METHOD`, `IMPORTS`, `CALLS`, `CALL_REFERENCE`, `HTTP_CALLS`, `ASYNC_CALLS`, `IMPLEMENTS`, `HANDLES`, `USAGE`, `CONFIGURES`, `WRITES`, `MEMBER_OF`, `TESTS`, `USES_TYPE`, `FILE_CHANGES_WITH`
707+
`CONTAINS_PACKAGE`, `CONTAINS_FOLDER`, `CONTAINS_FILE`, `DEFINES`, `DEFINES_METHOD`, `IMPORTS`, `CALLS`, `CALL_REFERENCE`, `HTTP_CALLS`, `ASYNC_CALLS`, `IMPLEMENTS`, `HANDLES`, `USAGE`, `CONFIGURES`, `REFERENCES_FILE`, `WRITES`, `MEMBER_OF`, `TESTS`, `USES_TYPE`, `FILE_CHANGES_WITH`
708708

709709
### Qualified Names
710710

‎internal/cbm/extract_calls.c‎

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ static const char *strip_quotes(CBMArena *a, const char *text) {
7979

8080
// Callee suffixes for IRIS Python interop string-dispatch. Kept at file scope
8181
// (not inside the function) to satisfy cppcheck variableScope.
82-
static const char *s_py_dispatch_suffixes[] = {".classMethodValue", ".classMethodVoid",
83-
".classMethodBoolean", ".classMethodObject", NULL};
82+
static const char *s_py_dispatch_suffixes[] = {".classMethodValue", ".classMethodVoid",
83+
".classMethodBoolean", ".classMethodObject",
84+
".invokeClassMethod", NULL};
8485

8586
// Per-language callee-suffix dispatch table — returns a NULL-terminated list of
8687
// method-name suffixes whose calls should be resolved by extracting class+method
@@ -2039,6 +2040,49 @@ static const char *extract_nth_string_arg(CBMExtractCtx *ctx, TSNode args, uint3
20392040
return NULL;
20402041
}
20412042

2043+
// IRIS embedded Python names the target class in the receiver:
2044+
// iris.cls("Pkg.Class").Method(...) calls ClassMethod Pkg.Class.Method.
2045+
// Returns "Pkg.Class.Method", or NULL unless the receiver is iris.cls() with
2046+
// a string-literal first argument. A non-literal class names nothing, so it
2047+
// gets no class-qualified callee rather than a guessed one.
2048+
static const char *python_iris_cls_callee(CBMExtractCtx *ctx, TSNode call_node) {
2049+
TSNode fn = ts_node_child_by_field_name(call_node, TS_FIELD("function"));
2050+
if (ts_node_is_null(fn) || strcmp(ts_node_type(fn), "attribute") != 0) {
2051+
return NULL;
2052+
}
2053+
TSNode recv = ts_node_child_by_field_name(fn, TS_FIELD("object"));
2054+
TSNode meth = ts_node_child_by_field_name(fn, TS_FIELD("attribute"));
2055+
if (ts_node_is_null(recv) || ts_node_is_null(meth) || strcmp(ts_node_type(recv), "call") != 0) {
2056+
return NULL;
2057+
}
2058+
TSNode recv_fn = ts_node_child_by_field_name(recv, TS_FIELD("function"));
2059+
TSNode recv_args = ts_node_child_by_field_name(recv, TS_FIELD("arguments"));
2060+
if (ts_node_is_null(recv_fn) || ts_node_is_null(recv_args) ||
2061+
ts_node_named_child_count(recv_args) == 0) {
2062+
return NULL;
2063+
}
2064+
const char *recv_text = cbm_node_text(ctx->arena, recv_fn, ctx->source);
2065+
if (!recv_text || strcmp(recv_text, "iris.cls") != 0) {
2066+
return NULL;
2067+
}
2068+
TSNode cls_arg = ts_node_named_child(recv_args, 0);
2069+
if (!is_string_like(ts_node_type(cls_arg))) {
2070+
return NULL;
2071+
}
2072+
// Plain quoted literals only: an f-string or other prefixed string is a
2073+
// "string" node too, but its text is not a class name.
2074+
char *cls_text = cbm_node_text(ctx->arena, cls_arg, ctx->source);
2075+
if (!cls_text || (cls_text[0] != '"' && cls_text[0] != '\'')) {
2076+
return NULL;
2077+
}
2078+
const char *cls = strip_and_validate_string_arg(ctx->arena, cls_text);
2079+
const char *mth = cbm_node_text(ctx->arena, meth, ctx->source);
2080+
if (!cls || !cls[0] || !mth || !mth[0]) {
2081+
return NULL;
2082+
}
2083+
return cbm_arena_sprintf(ctx->arena, "%s.%s", cls, mth);
2084+
}
2085+
20422086
// --- Unified handler: called once per node by the cursor walk ---
20432087

20442088
// Process a keyword argument (keyword_argument or pair node).
@@ -3887,6 +3931,16 @@ CBMInvocationDescriptor handle_calls(CBMExtractCtx *ctx, TSNode node, const CBML
38873931
}
38883932
}
38893933

3934+
// #1260: iris.cls("Pkg.X").M() names its class, so the qualified
3935+
// callee replaces the bare one. Keeping both would let the bare
3936+
// name weak-match an unrelated same-named method.
3937+
if (ctx->language == CBM_LANG_PYTHON) {
3938+
const char *iris_callee = python_iris_cls_callee(ctx, node);
3939+
if (iris_callee) {
3940+
call.callee_name = iris_callee;
3941+
call.is_method = false;
3942+
}
3943+
}
38903944
cbm_calls_push(&ctx->result->calls, ctx->arena, call);
38913945
invocation = describe_emitted_primary_call(node, &callee);
38923946

0 commit comments

Comments
 (0)