Files
sx/examples/ffi-jni/1403-ffi-jni-call-04-jint-return.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

29 lines
897 B
Plaintext

// Phase 1 step 1.18 (PLAN-FFI.md): `#jni_call(i32)` (jint return).
// Today the lowering for any non-void return drops to `LLVMGetUndef`
// — the IR snapshot captures that placeholder. Step 1.18-fix wires
// the `.i32 => 49` (`CallIntMethod`) arm and the snapshot updates to
// show the full GetObjectClass + GetMethodID + CallIntMethod
// sequence (using the cache machinery landed in 1.17).
//
// Runtime: unreachable. Same `g_should_call` global pattern as
// `ffi-jni-call-03` — keeps `read_int` alive so the IR snapshot has
// the JNI lowering visible, but the dereferences never execute.
#import "modules/std.sx";
g_should_call : bool = false;
read_int :: (env: *void, target: *void) -> i32 {
#jni_env(env) {
#jni_call(i32)(target, "getCount", "()I")
}
}
main :: () -> i32 {
if g_should_call {
_ := read_int(null, null);
}
print("ok\n");
0
}