ffi 0.8: switch form for the inline-if OS branch (no behavior change)

`inline if OS == { case .macos: ... case .ios: ... else: ... }` is
already supported (see library/modules/platform/sdl3.sx:42 and
examples/38-build-config.sx:30). Cleaner than the chained
`inline if OS == .a;  inline if OS == .b;  ...` form the prior
commit used.

Same expected output — only the macOS arm survives codegen on the
host. Snapshot unchanged.
This commit is contained in:
agra
2026-05-19 12:01:01 +03:00
parent 608ff34d55
commit efc482a055

View File

@@ -56,15 +56,14 @@ main :: () -> s32 {
adder := make_adder(100); adder := make_adder(100);
print("closure(5) = {}\n", adder(5)); print("closure(5) = {}\n", adder(5));
// 4. inline if OS branch — only one platform's call actually emits // 4. inline if OS branch — only one arm survives codegen on a
inline if OS == .macos { // given target. `inline if X == { case ... }` reads cleaner
print("inline if macos = {}\n", ffi_method_helper(7)); // than chained `inline if X == .a; inline if X == .b; ...`.
} inline if OS == {
inline if OS == .ios { case .macos: { print("inline if macos = {}\n", ffi_method_helper(7)); }
print("inline if ios = {}\n", ffi_method_helper(7)); case .ios: { print("inline if ios = {}\n", ffi_method_helper(7)); }
} case .linux: { print("inline if linux = {}\n", ffi_method_helper(7)); }
inline if OS == .linux { else: { print("inline if other = {}\n", ffi_method_helper(7)); }
print("inline if linux = {}\n", ffi_method_helper(7));
} }
0; 0;