Lands the full VM/compiler-API arc on branch reify (701/0 both gates): - abi(.compiler) ABI replaces abi(.zig) extern compiler + the fake #library "compiler"; bodiless decl = compiler-API surface, bodied = user compiler-domain fn (lowered for VM eval, emit-skipped). - out is a plain sx fn (libc write) — the out builtin deleted; the VM handles it via host-FFI. trace_resolve + interp_print_frames ported. - 4B VM-native diagnostics: 1179/1180 render proper comptime type construction failed: under strict. - S5a: build_options/set_post_link_callback on abi(.compiler) with BuildConfig threaded into the VM (green intermediate). - 0522 fixed (describe(args: []Type)); regression 0638. Strict deletion-gate down to 4 compiler_call bails (1609/1614/1615/1616) + 1654 (legitimate unresolvable-symbol diagnostic).
46 lines
1.4 KiB
Plaintext
46 lines
1.4 KiB
Plaintext
#import "modules/std.sx";
|
|
#import "modules/build.sx";
|
|
|
|
// --- #run build configuration ---
|
|
// build_options() returns a BuildOptions struct at compile time.
|
|
// Methods on it (add_link_flag, set_output_path) are compiler builtins
|
|
// that configure the build without runtime cost.
|
|
|
|
configure_build :: () abi(.compiler) {
|
|
opts := build_options();
|
|
// These calls are intercepted by the compiler at compile time.
|
|
// On a normal (non-wasm) target, inline if gates them off.
|
|
inline if OS == .wasm {
|
|
opts.set_output_path("sx-out/wasm/test.html");
|
|
opts.add_link_flag("-sUSE_SDL=3");
|
|
}
|
|
}
|
|
#run configure_build();
|
|
|
|
// --- inline if with compiler constants ---
|
|
|
|
main :: () {
|
|
// Verify #run configure_build() executed without error
|
|
print("build config: ok\n");
|
|
|
|
// Verify compiler constants are available
|
|
print("pointer size: {}\n", POINTER_SIZE);
|
|
|
|
// Verify inline if with OS/ARCH works
|
|
inline if OS == {
|
|
case .macos: { print("os: macos\n"); }
|
|
case .linux: { print("os: linux\n"); }
|
|
case .windows: { print("os: windows\n"); }
|
|
case .wasm: { print("os: wasm\n"); }
|
|
else: { print("os: unknown\n"); }
|
|
}
|
|
|
|
// Verify POINTER_SIZE is usable in inline if
|
|
inline if POINTER_SIZE == 8 {
|
|
print("64-bit platform\n");
|
|
}
|
|
inline if POINTER_SIZE == 4 {
|
|
print("32-bit platform\n");
|
|
}
|
|
}
|