Preserve the historical registry fallback for an unshadowed function: it * keeps ordinary direct-call resolution stable. When a definition actually * replaces a prior binding (import, wildcard uncertainty, class, assignment), * record the new exact callable value or clear the stale identity. */
| 4780 | * replaces a prior binding (import, wildcard uncertainty, class, assignment), |
| 4781 | * record the new exact callable value or clear the stale identity. */ |
| 4782 | static void py_bind_module_function(PyLSPContext *ctx, TSNode func_node) { |
| 4783 | if (!ctx || ts_node_is_null(func_node) || !ctx->module_qn) |
| 4784 | return; |
| 4785 | TSNode name_node = ts_node_child_by_field_name(func_node, "name", 4); |
| 4786 | char *name = py_node_text(ctx, name_node); |
| 4787 | if (!name || !name[0]) { |
| 4788 | py_disable_callable_value_proof(ctx); |
| 4789 | return; |
| 4790 | } |
| 4791 | if (!cbm_scope_contains(ctx->current_scope, name)) |
| 4792 | return; |
| 4793 | |
| 4794 | const char *qn = cbm_arena_sprintf(ctx->arena, "%s.%s", ctx->module_qn, name); |
| 4795 | if (!qn) { |
| 4796 | py_disable_callable_value_proof(ctx); |
| 4797 | py_scope_bind(ctx, name, cbm_type_unknown()); |
| 4798 | return; |
| 4799 | } |
| 4800 | const CBMRegisteredFunc *func = cbm_registry_lookup_func(ctx->registry, qn); |
| 4801 | if (py_func_is_exact_callable_value(func)) { |
| 4802 | py_scope_bind_callable(ctx, name, cbm_type_unknown(), func->qualified_name); |
| 4803 | } else { |
| 4804 | py_scope_bind(ctx, name, cbm_type_unknown()); |
| 4805 | } |
| 4806 | } |
| 4807 | |
| 4808 | static bool py_import_statement_is_wildcard(TSNode stmt) { |
| 4809 | uint32_t count = ts_node_named_child_count(stmt); |
no test coverage detected