Skip to content

Commit ace384c

Browse files
committed
fix(python): walk a class nested in a class under its outer class
py_process_class qualified every class under the module, so a class nested in a class (proj.m.Outer.Inner, the QN extraction gives it) was walked as proj.m.Inner: its methods' LSP rows carried callers no node has and never joined. A typed-parameter call in such a method got no edge at all, a self call fell to unique_name and a constructor to same_module. A nested class, decorated or not, is now walked under its enclosing class through the same py_process_class_in the function-local classes use. Tests: pipeline_python_nested_class_methods_resolve(_parallel). Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent e772ff8 commit ace384c

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎internal/cbm/lsp/py_lsp.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4706,9 +4706,15 @@ static void py_process_class_in(PyLSPContext *ctx, TSNode class_node, const char
47064706
strcmp(ts_node_type(def), "function_definition") == 0 &&
47074707
!py_is_init_method(ctx, def)) {
47084708
py_process_function(ctx, def, ctx->enclosing_class_qn);
4709+
} else if (!ts_node_is_null(def) &&
4710+
strcmp(ts_node_type(def), "class_definition") == 0) {
4711+
py_process_class_in(ctx, def, ctx->enclosing_class_qn);
47094712
}
47104713
} else if (strcmp(ck, "class_definition") == 0) {
4711-
py_process_class(ctx, c);
4714+
/* A class nested in a class is qualified by its outer class
4715+
* (proj.m.Outer.Inner), the QN extraction gives it; under the
4716+
* module its methods' calls never joined their callers. */
4717+
py_process_class_in(ctx, c, ctx->enclosing_class_qn);
47124718
}
47134719
}
47144720
}

0 commit comments

Comments
 (0)