MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / rust_map_source_range

Function rust_map_source_range

internal/cbm/lsp/rust_lsp.c:4021–4043  ·  view source on GitHub ↗

Inject a synthetic CBMCall into result->calls so the downstream pipeline * (cbm_pipeline_find_lsp_resolution) can pair it with the resolved_call and * emit a CALLS edge. `callee_qn`'s last dot segment is used as the textual * callee_name, matching how the resolver's short-name comparison works. Only * used for calls the syntactic extractor cannot see (operator desugaring, * macro-hidden metho

Source from the content-addressed store, hash-verified

4019 * used for calls the syntactic extractor cannot see (operator desugaring,
4020 * macro-hidden method calls). */
4021static bool rust_map_source_range(const RustLSPContext *ctx, uint32_t start, uint32_t end,
4022 uint32_t *mapped_start, uint32_t *mapped_end) {
4023 if (!ctx || !mapped_start || !mapped_end || end <= start)
4024 return false;
4025 if (ctx->site_map_active) {
4026 if (start < ctx->site_map_synthetic_start_byte || end > ctx->site_map_synthetic_end_byte) {
4027 return false;
4028 }
4029 *mapped_start =
4030 ctx->site_map_original_start_byte + (start - ctx->site_map_synthetic_start_byte);
4031 *mapped_end =
4032 ctx->site_map_original_start_byte + (end - ctx->site_map_synthetic_start_byte);
4033 return *mapped_end > *mapped_start;
4034 }
4035 /* Only the immutable root buffer has identity coordinates. A
4036 * macro_rules! transcriber is reparsed from substituted generated text and
4037 * cannot be mapped by a single offset. */
4038 if (ctx->source != ctx->root_source)
4039 return false;
4040 *mapped_start = start;
4041 *mapped_end = end;
4042 return true;
4043}
4044
4045static void rust_inject_syn_call(RustLSPContext *ctx, const char *callee_qn) {
4046 if (!ctx || !ctx->syn_calls || !callee_qn || !ctx->enclosing_func_qn)

Calls

no outgoing calls

Tested by

no test coverage detected