GtBridge.Beam (gt_bridge v0.19.2)

Copy Markdown View Source

I read beam-file chunks directly.

Code.fetch_docs/1 pulls the whole object code through :code.get_object_code/1; seeking to the one chunk is ~2.7x cheaper (851us -> 319us for Enum), and doc reads happen on every dot keystroke and on app-wide coverage sweeps.

Public API

Summary

Functions

I return the docs_v1 chunk term for module, or :error.

I return mod.__info__(kind) or []: __info__/1 can raise for some macro-only modules despite exporting it.

The shape of an exports-only entry: a runtime function with no textual def, carrying a synthesized source (with an @spec line when the BEAM knows one).

I return %{{name, arity} => formatted_spec_string} for every function the BEAM has a typespec for; used to enrich macro-generated entries that have no source.

Functions

docs(module)

@spec docs(module()) :: tuple() | :error

I return the docs_v1 chunk term for module, or :error.

info(mod, kind)

@spec info(module(), atom()) :: term()

I return mod.__info__(kind) or []: __info__/1 can raise for some macro-only modules despite exporting it.

runtime_stub(name_str, arity, spec)

@spec runtime_stub(String.t(), arity(), String.t() | nil) :: map()

The shape of an exports-only entry: a runtime function with no textual def, carrying a synthesized source (with an @spec line when the BEAM knows one).

specs_by_arity(mod)

@spec specs_by_arity(module()) :: %{required({atom(), arity()}) => String.t()}

I return %{{name, arity} => formatted_spec_string} for every function the BEAM has a typespec for; used to enrich macro-generated entries that have no source.