Files
sx/examples/1418-ffi-jni-class-08-call.sx
agra 811a280517 refactor(ffi-linkage): Phase 9.3 — purge 'foreign' from comments (src caps + examples + docs)
src/: ~21 capital-Foreign comments the case-sensitive verify grep missed
(Foreign-class→Runtime-class, Foreign path→Runtime path, Foreign decls→Extern decls,
FOREIGN function→extern function) across calls/inst/ffi_objc/jni_descriptor/emit_llvm/
c_import/lower.*/ops. src 'foreign' now = ONLY the hash_foreign token + 4 rejection
messages (9.0-delete targets). examples/*.sx comments → extern/runtime-class (1219
stdout regen; KEPT 1176). docs/inline-asm-design + debugger purged. Comments only —
no build impact. 9.0 ratified: DELETE hash_foreign token next.
2026-06-15 10:52:56 +03:00

32 lines
901 B
Plaintext

// Phase 2 step 2.11 (PLAN-FFI.md): xfail then green for DSL call-site
// lowering — `inst.method(args)` on a `#jni_class`-typed value lowers
// to `#jni_call(T)(inst, "method", "(sig)Ret", args...)` with the
// descriptor auto-derived from the sx signature.
//
// `#jni_env(env)` brings env into lexical scope; the omitted-env
// `#jni_call` form (2.16b) picks it up directly.
#import "modules/std.sx";
Activity :: #jni_class("android/app/Activity") extern {
getWindow :: (self: *Self) -> *void;
}
g_should_call : bool = false;
unused_jni :: (env: *void, act: *Activity) {
#jni_env(env) {
// Today: this fails — sema doesn't know `Activity` as a type, or
// the method dispatch doesn't recognize runtime-class members.
win := act.getWindow();
}
}
main :: () -> i32 {
if g_should_call {
unused_jni(null, null);
}
print("ok\n");
0
}