Merge pull request #982 from Dhruvy0804/fix/issue-842-clobber-class

fix(pipeline): guard env-access CONFIGURES and throws sources against…
This commit is contained in:
Martin Vogel
2026-07-09 21:07:57 +02:00
committed by GitHub
5 changed files with 419 additions and 4 deletions
+6
View File
@@ -425,6 +425,12 @@ static int create_env_configures_for_file(cbm_pipeline_ctx_t *ctx, const CBMFile
const cbm_gbuf_node_t *src = NULL;
if (ea->enclosing_func_qn && ea->enclosing_func_qn[0]) {
src = cbm_gbuf_find_by_qn(ctx->gbuf, ea->enclosing_func_qn);
/* A class-level env access in a directory-module language carries
* the DIRECTORY module QN, which hits the shared Folder/Project
* node — attribute to this file's File node instead (#787, #842). */
if (cbm_pipeline_node_is_dir_container(src)) {
src = NULL;
}
}
if (!src) {
if (!file_qn) {
+8 -4
View File
@@ -2406,14 +2406,18 @@ static void resolve_file_usages(resolve_ctx_t *rc, resolve_worker_state_t *ws,
/* Resolve throws/raises for one file. */
static void resolve_file_throws(resolve_ctx_t *rc, resolve_worker_state_t *ws,
CBMFileResult *result, const char *module_qn, const char **imp_keys,
const char **imp_vals, int imp_count) {
CBMFileResult *result, const char *rel, const char *module_qn,
const char **imp_keys, const char **imp_vals, int imp_count) {
for (int t = 0; t < result->throws.count; t++) {
CBMThrow *thr = &result->throws.items[t];
if (!thr->exception_name || !thr->enclosing_func_qn) {
continue;
}
const cbm_gbuf_node_t *src = cbm_gbuf_find_by_qn(rc->main_gbuf, thr->enclosing_func_qn);
/* find_source_node falls back to the per-file File node when the
* lookup lands on a shared Folder/Project node (#787, #842) — same
* guard resolve_file_calls/usages/rw already use. */
const cbm_gbuf_node_t *src =
find_source_node(rc->main_gbuf, rc->project_name, rel, thr->enclosing_func_qn);
if (!src) {
continue;
}
@@ -2822,7 +2826,7 @@ static void resolve_worker(int worker_id, void *ctx_ptr) {
/* ── THROWS / RAISES ───────────────────────────────────── */
_ph_t0 = extract_now_ns();
resolve_file_throws(rc, ws, result, module_qn, imp_keys, imp_vals, imp_count);
resolve_file_throws(rc, ws, result, rel, module_qn, imp_keys, imp_vals, imp_count);
atomic_fetch_add_explicit(&rc->time_ns_throws, extract_now_ns() - _ph_t0,
memory_order_relaxed);