Skip to main content

add_tiles

Function add_tiles 

Source
pub fn add_tiles(
    file: &mut PolydatFile,
    tiles: Vec<TileDef>,
) -> Result<(), String>
Expand description

Add tiles a host built from what it holds to the program, as tile statements at its top level.

A tile a host supplies is the same thing as a tile the author wrote: it is one tile statement either way, and from here on the program’s own typing, lifecycle classification and engine selection apply to it exactly as they apply to the author’s. That is why this is a transform and not a compile entry point — a host that also wants assign_values, or a rewrite of its own, applies them to the same tree in whatever order it means, and compiles once.

A tile whose name the program already declares is an error naming it, rather than a second declaration for the compiler to resolve. The check reaches module and for bodies, so a host cannot shadow a nested tile without knowing it.