GtBridge.Resolve (gt_bridge v0.17.1)

Copy Markdown View Source

Summary

Functions

I return {start_line, end_line} for a function definition in a module's source. Delegates to GtBridge.Analysis.all_functions/1 to avoid duplicating AST logic.

I return the source file path for an object, or nil if unavailable.

I read mod's source file once and pass the contents to fun, returning whatever fun returns. When the module has no source file or the file can't be read I return default -- macro-only modules, BEAM-only deps, etc. fall through cleanly without raising.

Functions

data_type_to_module(obj)

@spec data_type_to_module(any()) :: atom()

data_type_to_string(obj)

@spec data_type_to_string(any()) :: String.t()

function_lines(arg1)

@spec function_lines(GtBridge.Documentation.t()) ::
  {pos_integer(), pos_integer()} | nil

I return {start_line, end_line} for a function definition in a module's source. Delegates to GtBridge.Analysis.all_functions/1 to avoid duplicating AST logic.

function_lines(module, name, arity)

@spec function_lines(module(), atom(), non_neg_integer()) ::
  {pos_integer(), pos_integer()} | nil

source_file(obj)

@spec source_file(any()) :: String.t() | nil

I return the source file path for an object, or nil if unavailable.

with_source(mod, default, fun)

@spec with_source(module(), default, (String.t() -> default | result)) ::
  default | result
when default: any(), result: any()

I read mod's source file once and pass the contents to fun, returning whatever fun returns. When the module has no source file or the file can't be read I return default -- macro-only modules, BEAM-only deps, etc. fall through cleanly without raising.

Every analysis pass that walks a module's text (function extraction, alias map, eval preamble, editor session) routes through me so the source-resolution + read + fallback shape lives in one place.