diff --git a/examples/ffi-jni-env-01-block.sx b/examples/ffi-jni-env-01-block.sx new file mode 100644 index 0000000..a8c9aa0 --- /dev/null +++ b/examples/ffi-jni-env-01-block.sx @@ -0,0 +1,21 @@ +// Phase 2 step 2.16a (PLAN-FFI.md): xfail then green for the +// `#jni_env(env) { body }` block-form intrinsic. +// +// Scopes a JNIEnv* over a lexical block. Step 2.16a lands parser + +// AST + sema acceptance — the body runs as a normal block, the env +// arg is captured but not yet used at lowering. The TL push/pop +// semantics (step 2.16b) and lexical-direct resolution in `#jni_call` +// (step 2.16c) follow. +// +// Today the lexer doesn't recognise `#jni_env` and the parser errors +// at the unknown directive token. + +#import "modules/std.sx"; + +main :: () -> s32 { + synth_env : *void = null; + #jni_env(synth_env) { + print("inside #jni_env scope\n"); + } + 0; +} diff --git a/tests/expected/ffi-jni-env-01-block.exit b/tests/expected/ffi-jni-env-01-block.exit new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/tests/expected/ffi-jni-env-01-block.exit @@ -0,0 +1 @@ +1 diff --git a/tests/expected/ffi-jni-env-01-block.txt b/tests/expected/ffi-jni-env-01-block.txt new file mode 100644 index 0000000..3a3c7e4 --- /dev/null +++ b/tests/expected/ffi-jni-env-01-block.txt @@ -0,0 +1 @@ +/Users/agra/projects/sx/examples/ffi-jni-env-01-block.sx:17:5: error: unexpected token in expression