Gen Context¶
Import: import system.codegen;
find_type¶
The index entry named name, if the program declares such a type.
syntax_blocks¶
name { ... } sites introduced by this generator's name (@syntax_block generators).
call_sites¶
Calls of the functions named in this generator's @on_call(...).
options¶
dream.toml [[generators]].options, decoded into the @json type T.
option_or¶
One option as text (fallback when unset).
additional_files¶
Returns the files listed in [[generators]].additional_files in dream.toml.
replace¶
Rewrites block's site to the Dream expression source.
emit_file¶
Adds a complete Dream source file at the generator-relative path path (models.json.dream). It is written under generated/<entry>/<module-path>/<generator>/ and compiled with the program.
tools¶
Declared tools with the versions and fingerprints used in this compilation.
tool_results¶
Returns tool results from the previous generation round.
run_tool¶
Requests a declared tool. The generator runs again with the result in the next phase. id names the request (no /); inputs are emitted artifact paths copied into the tool's scratch folder; args are passed as-is with that folder as the working directory. outputs are files whose contents the next phase reads through tool_results(). opaque_outputs are files the generator only sees as path, hash and size, for large or binary results it embeds (emit_asset) or publishes (publish_tool_output) as tool:<id>/<path> without reading them. All requests of a phase run in parallel; results keep request order.
public fun run_tool(
id: string,
tool: string,
args: List<string>,
inputs: List<string>,
outputs: List<string>,
opaque_outputs: List<string>
): void
publish_tool_output¶
Copies a tool output, named tool:<request id>/<path>, to path next to the compiled program. Publishing the same path twice, or a path a compiler output uses, is an error.
emit_asset¶
Embeds an emitted artifact path, or a tool output named tool:<request id>/<path>, into every compilation target as the asset name, read at run time with Assets.bytes(name).
emit_asset¶
Embeds an artifact or tool output for the selected target triples or families.
consume¶
Takes over a selected or referenced top-level user function: it stays type-checked but is not compiled, and calling it from ordinary code is an error. help is shown under that error to say what to use instead, for example dispatch it with Shaders.blur.dispatch(...).
emit_artifact¶
Emits a non-Dream file with source mappings under this generator's directory.
public fun emit_artifact(
path: string,
contents: string,
borrow map: GenSourceMap,
publish: bool = false
): void
emit_artifact¶
Emits a binary file, such as packed GPU code, under this generator's directory. Binary artifacts have no source map; embed them with emit_asset or pass them to run_tool as inputs like text artifacts. With publish, the file is also copied beside the build output.
error_in_artifact¶
Reports an artifact location through its source map to the originating Dream node.
emit_extend¶
Extensions keep their declaring module, including its internal visibility and name scope.
error_at¶
An error at the node with identity target (any model node's id), or at the generator itself for an empty target.
warning_at¶
A warning at the node with identity target (any model node's id), or at the generator itself for an empty target.
error¶
Reports an error at the generator itself; generation fails after the generator exits.
error¶
Reports an error at the syntax block's site; generation fails after the generator exits.
error¶
Reports an error at the declaration; generation fails after the generator exits.