Skip to content

Commit 6b1cd8a

Browse files
committed
style(python): clang-format the nested-def binding and lexical step
Whitespace only; the token stream is unchanged. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 9cdae25 commit 6b1cd8a

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

‎internal/cbm/lsp/py_lsp.c‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4408,11 +4408,20 @@ static void py_bind_local_def(PyLSPContext *ctx, TSNode def, bool is_class) {
44084408
* them is still a local of the function; a nested def, class or lambda body
44094409
* is a scope of its own and is never entered. */
44104410
static bool py_is_statement_block(const char *kind) {
4411-
static const char *const kinds[] = {
4412-
"block", "if_statement", "elif_clause", "else_clause",
4413-
"for_statement", "while_statement", "try_statement", "except_clause",
4414-
"except_group_clause", "finally_clause", "with_statement", "match_statement",
4415-
"case_clause", NULL};
4411+
static const char *const kinds[] = {"block",
4412+
"if_statement",
4413+
"elif_clause",
4414+
"else_clause",
4415+
"for_statement",
4416+
"while_statement",
4417+
"try_statement",
4418+
"except_clause",
4419+
"except_group_clause",
4420+
"finally_clause",
4421+
"with_statement",
4422+
"match_statement",
4423+
"case_clause",
4424+
NULL};
44164425
for (int i = 0; kinds[i]; i++) {
44174426
if (strcmp(kind, kinds[i]) == 0)
44184427
return true;
@@ -4632,8 +4641,8 @@ static void py_process_class_in(PyLSPContext *ctx, TSNode class_node, const char
46324641
return;
46334642

46344643
const char *prev_class = ctx->enclosing_class_qn;
4635-
ctx->enclosing_class_qn = cbm_arena_sprintf(
4636-
ctx->arena, "%s.%s", container_qn ? container_qn : ctx->module_qn, cname);
4644+
ctx->enclosing_class_qn =
4645+
cbm_arena_sprintf(ctx->arena, "%s.%s", container_qn ? container_qn : ctx->module_qn, cname);
46374646

46384647
TSNode body = ts_node_child_by_field_name(class_node, "body", 4);
46394648
if (!ts_node_is_null(body)) {

‎src/pipeline/pass_calls.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,8 @@ static void handle_route_registration(cbm_pipeline_ctx_t *ctx, const CBMCall *ca
596596
call->enclosing_func_qn);
597597
}
598598
if (!hres.qualified_name) {
599-
hres = cbm_registry_resolve_handler(ctx->registry, call->second_arg_name,
600-
module_qn, imp_keys, imp_vals, imp_count,
601-
ctx->gbuf, lang);
599+
hres = cbm_registry_resolve_handler(ctx->registry, call->second_arg_name, module_qn,
600+
imp_keys, imp_vals, imp_count, ctx->gbuf, lang);
602601
}
603602
if (hres.qualified_name != NULL && hres.qualified_name[0] != '\0') {
604603
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
978977
cbm_resolution_t res = {0};
979978
if (!rust_external && !php_vendor_call) {
980979
/* Python LEGB fallback first (MUST match pass_parallel.c). */
981-
res = cbm_registry_resolve_call_scoped(ctx->registry, call->callee_name, module_qn,
982-
imp_keys, imp_vals, imp_count, lang,
983-
call->enclosing_func_qn);
980+
res =
981+
cbm_registry_resolve_call_scoped(ctx->registry, call->callee_name, module_qn, imp_keys,
982+
imp_vals, imp_count, lang, call->enclosing_func_qn);
984983
/* Cross-language veto: a name-only guess never binds another
985984
* language's symbol (a JS app.get must not become Python's
986985
* builtins.dict.get). The vetoed answer becomes EMPTY here, before

0 commit comments

Comments
 (0)