Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

style(python): clang-format the nested-def binding and lexical step

Martin Vogel6b1cd8aa0de7
diff --git a/internal/cbm/lsp/py_lsp.c b/internal/cbm/lsp/py_lsp.c
index cfc5499d4..18384d82e 100644
--- a/internal/cbm/lsp/py_lsp.c
+++ b/internal/cbm/lsp/py_lsp.c
@@ -4408,11 +4408,20 @@ static void py_bind_local_def(PyLSPContext *ctx, TSNode def, bool is_class) {
* them is still a local of the function; a nested def, class or lambda body
* is a scope of its own and is never entered. */
static bool py_is_statement_block(const char *kind) {
- static const char *const kinds[] = {
- "block", "if_statement", "elif_clause", "else_clause",
- "for_statement", "while_statement", "try_statement", "except_clause",
- "except_group_clause", "finally_clause", "with_statement", "match_statement",
- "case_clause", NULL};
+ static const char *const kinds[] = {"block",
+ "if_statement",
+ "elif_clause",
+ "else_clause",
+ "for_statement",
+ "while_statement",
+ "try_statement",
+ "except_clause",
+ "except_group_clause",
+ "finally_clause",
+ "with_statement",
+ "match_statement",
+ "case_clause",
+ NULL};
for (int i = 0; kinds[i]; i++) {
if (strcmp(kind, kinds[i]) == 0)
return true;
@@ -4632,8 +4641,8 @@ static void py_process_class_in(PyLSPContext *ctx, TSNode class_node, const char
return;
const char *prev_class = ctx->enclosing_class_qn;
- ctx->enclosing_class_qn = cbm_arena_sprintf(
- ctx->arena, "%s.%s", container_qn ? container_qn : ctx->module_qn, cname);
+ ctx->enclosing_class_qn =
+ cbm_arena_sprintf(ctx->arena, "%s.%s", container_qn ? container_qn : ctx->module_qn, cname);
TSNode body = ts_node_child_by_field_name(class_node, "body", 4);
if (!ts_node_is_null(body)) {
diff --git a/src/pipeline/pass_calls.c b/src/pipeline/pass_calls.c
index 77fa14f4a..80b2e69b8 100644
--- a/src/pipeline/pass_calls.c
+++ b/src/pipeline/pass_calls.c
@@ -596,9 +596,8 @@ static void handle_route_registration(cbm_pipeline_ctx_t *ctx, const CBMCall *ca
call->enclosing_func_qn);
}
if (!hres.qualified_name) {
- hres = cbm_registry_resolve_handler(ctx->registry, call->second_arg_name,
- module_qn, imp_keys, imp_vals, imp_count,
- ctx->gbuf, lang);
+ hres = cbm_registry_resolve_handler(ctx->registry, call->second_arg_name, module_qn,
+ imp_keys, imp_vals, imp_count, ctx->gbuf, lang);
}
if (hres.qualified_name != NULL && hres.qualified_name[0] != '\0') {
const cbm_gbuf_node_t *handler = cbm_gbuf_find_by_qn(ctx->gbuf, hres.qualified_name);
@@ -978,9 +977,9 @@ static int resolve_single_call(cbm_pipeline_ctx_t *ctx, CBMCall *call, const CBM
cbm_resolution_t res = {0};
if (!rust_external && !php_vendor_call) {
/* Python LEGB fallback first (MUST match pass_parallel.c). */
- res = cbm_registry_resolve_call_scoped(ctx->registry, call->callee_name, module_qn,
- imp_keys, imp_vals, imp_count, lang,
- call->enclosing_func_qn);
+ res =
+ cbm_registry_resolve_call_scoped(ctx->registry, call->callee_name, module_qn, imp_keys,
+ imp_vals, imp_count, lang, call->enclosing_func_qn);
/* Cross-language veto: a name-only guess never binds another
* language's symbol (a JS app.get must not become Python's
* builtins.dict.get). The vetoed answer becomes EMPTY here, before