Skip to main content

resolve_code_entity

Function resolve_code_entity 

Source
pub fn resolve_code_entity(
    dir: &Arc<DirGraph>,
    name: &str,
    node_type: Option<&str>,
) -> (Option<NodeIndex>, Vec<(NodeIndex, NodeInfo)>)
Expand description

Resolve a name (or qualified-name suffix) to a single code-entity NodeIndex. Returns (Some(idx), Vec::new()) for an unambiguous match, (None, matches) when 0 or >1 candidates matched.

Lookup order:

  1. Exact match on node.id() (the qualified name, e.g. crate::graph::languages::cypher::executor::CypherExecutor::execute_single_clause)
  2. Suffix match on node.id() if name contains :: (e.g. CypherExecutor::execute_single_clause matches the above)
  3. Exact match on node.get_field_ref("name") or node.get_field_ref("title") — bare-name fallback

When node_type is None, searches across every entry in CODE_TYPES; otherwise restricted to the single type.