GtBridge.Analysis.Graph (gt_bridge v0.19.2)

Copy Markdown View Source

I answer the xref-backed graph questions: module dependency edges, callers and callees, implementors of a named function (with default-arg arities resolved to their defining clause), and call references across loaded applications.

Summary

Functions

I return the modules that mod calls within app.

I return the modules within app that call mod.

I return all call sites of mod.name/arity across loaded applications.

I return all modules that define a function with the given name and optional arity. Includes def, defp, and macro-generated functions.

I return module-level call edges for an application.

Types

edge()

@type edge() :: {module(), module()}

Functions

callees(mod, app)

@spec callees(module(), atom()) :: [module()]

I return the modules that mod calls within app.

callers(mod, app)

@spec callers(module(), atom()) :: [module()]

I return the modules within app that call mod.

function_references(mod, name, arity \\ nil)

@spec function_references(module() | nil, atom(), non_neg_integer() | nil) :: [map()]

I return all call sites of mod.name/arity across loaded applications.

Each result has :module (calling module), :function (calling function), and :arity.

When mod is nil I match callers of name/arity regardless of target module — used by GT-side C-n when the call is a runtime variable (builder.text(...), &1.inserted_at) or an unqualified Kernel/imported function and we can't statically know the target.

implementors(name, arity \\ nil)

@spec implementors(atom(), non_neg_integer() | nil) :: [map()]

I return all modules that define a function with the given name and optional arity. Includes def, defp, and macro-generated functions.

module_graph(app)

@spec module_graph(atom()) :: [edge()]

I return module-level call edges for an application.

Each edge {from, to} means from contains a call to a function in to. Self-edges are excluded. Only modules whose BEAM files are on the code path are analyzed.