| 137 | /* ── init / context ─────────────────────────────────────────────── */ |
| 138 | |
| 139 | void php_lsp_init(PHPLSPContext *ctx, CBMArena *arena, const char *source, int source_len, |
| 140 | const CBMTypeRegistry *registry, const char *module_qn, |
| 141 | CBMResolvedCallArray *out) { |
| 142 | memset(ctx, 0, sizeof(*ctx)); |
| 143 | ctx->arena = arena; |
| 144 | ctx->source = source; |
| 145 | ctx->source_len = source_len; |
| 146 | ctx->registry = registry; |
| 147 | ctx->module_qn = module_qn; |
| 148 | ctx->current_namespace_qn = ""; |
| 149 | ctx->resolved_calls = out; |
| 150 | ctx->current_scope = cbm_scope_push(arena, NULL); |
| 151 | |
| 152 | const char *dbg = getenv("CBM_LSP_DEBUG"); |
| 153 | ctx->debug = (dbg && dbg[0]); |
| 154 | } |
| 155 | |
| 156 | void php_lsp_add_use(PHPLSPContext *ctx, const char *local_name, const char *target_qn, |
| 157 | int use_kind) { |
no test coverage detected