diff --git a/examples/ffi-08-foreign-in-method.sx b/examples/ffi-08-foreign-in-method.sx index a0bf12f..afa9834 100644 --- a/examples/ffi-08-foreign-in-method.sx +++ b/examples/ffi-08-foreign-in-method.sx @@ -56,15 +56,14 @@ main :: () -> s32 { adder := make_adder(100); print("closure(5) = {}\n", adder(5)); - // 4. inline if OS branch — only one platform's call actually emits - inline if OS == .macos { - print("inline if macos = {}\n", ffi_method_helper(7)); - } - inline if OS == .ios { - print("inline if ios = {}\n", ffi_method_helper(7)); - } - inline if OS == .linux { - print("inline if linux = {}\n", ffi_method_helper(7)); + // 4. inline if OS branch — only one arm survives codegen on a + // given target. `inline if X == { case ... }` reads cleaner + // than chained `inline if X == .a; inline if X == .b; ...`. + inline if OS == { + case .macos: { print("inline if macos = {}\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)); } + else: { print("inline if other = {}\n", ffi_method_helper(7)); } } 0;