Skip to main content

Module call_hierarchy

Module call_hierarchy 

Source
Expand description

Call hierarchy support for the Solidity language server.

This module provides the query logic and LSP conversion helpers for the Call Hierarchy feature (textDocument/prepareCallHierarchy, callHierarchy/incomingCalls, callHierarchy/outgoingCalls).

§Architecture

Call hierarchy queries are derived from the same nodes index that powers textDocument/references. Every AST node with a referencedDeclaration is a potential call edge. The caller/callee relationship is resolved via span containment: for each reference node, we find the smallest enclosing FunctionDefinition or ModifierDefinition — that is the “caller”.

This approach works uniformly on both fresh builds (CachedBuild::new()) and warm-loaded builds (from_reference_index()) because the nodes index is always populated.

§Equivalence

When base_function_implementation is populated, incoming calls expand the target to include all equivalent IDs (interface ↔ implementation), so callers via interface-typed references are included.

Functions§

call_src_to_range
Convert a call_src string to an LSP Range.
decl_to_hierarchy_item
Convert a DeclNode into a CallHierarchyItem.
find_node_info
Find a node in the nodes index by ID, searching all files.
incoming_calls
Find all incoming calls to the given target IDs.
node_info_to_hierarchy_item
Convert a NodeInfo (from the nodes index) into a CallHierarchyItem.
outgoing_calls
Find all outgoing calls from a given caller function/modifier.
resolve_callable_at_position
Resolve a callable at a cursor position.
resolve_target_in_build
Resolve a target callable’s node IDs within a single build.
verify_node_identity
Verify that a NodeId in a specific build refers to the expected source entity.