Find the source node for an edge: enclosing function or file node. */
| 2041 | |
| 2042 | /* Find the source node for an edge: enclosing function or file node. */ |
| 2043 | static const cbm_gbuf_node_t *find_source_node(const cbm_gbuf_t *gbuf, const char *project, |
| 2044 | const char *rel, const char *enclosing_qn) { |
| 2045 | const cbm_gbuf_node_t *src = NULL; |
| 2046 | if (enclosing_qn) { |
| 2047 | src = cbm_gbuf_find_by_qn(gbuf, enclosing_qn); |
| 2048 | /* A class-level reference in a directory-module language carries the |
| 2049 | * DIRECTORY module QN, which hits the shared Folder/Project node — |
| 2050 | * attribute to this file's File node instead (#787). */ |
| 2051 | if (cbm_pipeline_node_is_dir_container(src)) { |
| 2052 | src = NULL; |
| 2053 | } |
| 2054 | } |
| 2055 | if (!src) { |
| 2056 | char *file_qn = cbm_pipeline_fqn_compute(project, rel, "__file__"); |
| 2057 | src = cbm_gbuf_find_by_qn(gbuf, file_qn); |
| 2058 | free(file_qn); |
| 2059 | } |
| 2060 | return src; |
| 2061 | } |
| 2062 | |
| 2063 | /* Field type hint resolution for obj.Method() with multiple candidates. |
| 2064 | * Strips C# field prefixes (_ / m_), capitalizes to get type name, and |
no test coverage detected