ToolCall.TypeSource behaviour (ToolCall v0.4.0)

Copy Markdown

Internal contract for function-declaration sources.

A source loads its compile-time state once, then returns a Declaration for a function name and arity. the builder consumes the declaration; wire emitters never see a source-specific AST.

Summary

Types

state()

@type state() :: term()

Callbacks

fetch(state, atom, non_neg_integer)

@callback fetch(state(), atom(), non_neg_integer()) ::
  {:ok, ToolCall.TypeSource.Declaration.t()}
  | {:error, [ToolCall.Diagnostic.t()]}

load(module, t)

@callback load(module(), Macro.Env.t()) :: state()