Files
sx/examples/platform/1664-platform-on-build-callback.sx
agra 66bdc70bf1 test: group examples into per-category folders
Move examples/*.sx and their expected/ snapshots into per-category
subfolders (examples/<category>/...). Folder = leading filename token,
with ffi-objc/ffi-jni kept whole; filenames are unchanged. The corpus
runner and LSP sweep now discover each category's expected/ dir, while
issues/ stays flat. Example 1058's repo-root-relative companion import
is made file-relative. Path strings embedded in 164 snapshots were
regenerated (path-only changes). Test-layout docs in CLAUDE.md updated.
2026-06-21 14:41:34 +03:00

22 lines
822 B
Plaintext

#import "modules/std.sx";
#import "modules/build.sx";
// P5.4 — the `on_build` override. A user `#run on_build(build);` replaces the
// stdlib `default_pipeline` as the build driver; the compiler invokes it after
// codegen with the `BuildOptions` handle. This build GROWS a `List` on the build
// VM (comptime List growth works only on the VM — issue 0141; the legacy interp
// fails it) then DELEGATES to `default_pipeline` for the real emit + link, so a
// working binary is still produced → "runtime main".
build :: (opt: BuildOptions) -> bool abi(.compiler) {
names := List(string).{};
names.append("alpha");
names.append("beta");
names.append("gamma");
if names.len != 3 { return false; }
return default_pipeline(opt);
}
#run on_build(build);
main :: () { print("runtime main\n"); }