Explorer

core.compile-to-wasm

description
Compile an expression into a Wasm module (Wasm GC) whose evaluate function returns the result value (a reference to a struct of the GC heap, read by src/stage1_compiler.ts through the exported runtime functions). parts may hold more parts than the expression uses: it takes the parts the expression references (also inside quotes, core.quote-part-ids), computes the constant parts among them at compile time first (core.compile-fold-constant-parts), so the module does not compute them again at run time, and compiles only the parts the code then needs (core.compile-reachable-parts). An ordinary function: it gives the same module at run time and at compile time. See docs/compile-time-evaluation.md
type
Fn(expr: @core.expression, parts: List<Record{id: String, expression: @core.expression}>) -> List<Number>
expression
fn(expr$0, parts$1) =>
  let referenced$2 = @core.compile-parts-of(ids: @core.quote-part-ids(expr: $0, found: [], parts: $1), parts: $1);
  @core.compile-module(
    expr: $0,
    parts: @core.compile-reachable-parts(expr: $0, parts: @core.compile-fold-constant-parts(parts: $2)),
    quote_parts: $2
  )
visibility
public
core.compile-to-wasm (project definy, branch main, snapshot CfIAXM725tR74SWd4aoTUz4-JJQfqnllblZbQ2Sv204)
id: qa22gxxdhfOt256rc_LSu3zqtiBlyNiZAUzdjfjj2ks
content hash: p1_ZAg6GV0vGX3FK2mIrmeD2EvuXKTssXcpqUKIRihM