✓
Passing This code compiles and runs correctly.
Code
// Test: Custom Compiler Coordinator Override
//
// Validates that users can override the abstract coordinate event
// with their own pipeline implementation using cross-module overrides (~mod:event = ...).
//
// The custom coordinator prints a marker, then delegates to standard pipeline.
~import std/compiler
~import std/optimizer
const std = @import("std");
const ast = @import("ast");
const Program = ast.Program;
// Custom coordinator that wraps the default pipeline
// All compiler events must be module-qualified
~std/compiler:coordinate = custom-marker() |> std/compiler:context-create(program_ast, allocator): c0 |> std/compiler:elaborate(ctx: c0): c1 |> std/compiler:transform-taps(ctx: c1): c2 |> std/compiler:analysis(ctx: c2)
| ctx c3 |> std/compiler:test-generation(ctx: c3): c4 |> std/optimizer:optimize(ctx: c4): c5 |> std/compiler:emission(ctx: c5): c6 => coordinated {
c6.ctx.ast,
c6.code,
metrics: "Custom coordinator ran!"
}
| failed f => error f.message
// Helper event to print marker (must be comptime since it's called from coordinate handler)
~[comptime] tor custom-marker {}
~proc custom-marker|zig {
std.debug.print("CUSTOM COORDINATOR: Pipeline override active!\n", .{});
}
// Simple test event
~pub tor hello {}
~proc hello|zig {
std.debug.print("Hello from custom-compiled code!\n", .{});
}
~hello()
Actual
Hello from custom-compiled code!
Flows
subflow ~coordinate click a branch to expand · @labels scroll to their anchor
custom-marker
flow ~hello click a branch to expand · @labels scroll to their anchor
hello
Test Configuration
MUST_RUN