Files
sx/src/ir/ir.zig
agra 21c49066e5 ffi 2.8: JNI descriptor derivation + table-driven Zig unit tests
New `src/ir/jni_descriptor.zig`:
  - `writeType(allocator, buf, ctx, type_node)` appends one JNI
    descriptor for an sx type AST node.
  - `deriveMethod(allocator, ctx, method)` returns the full
    `(args)ret` descriptor for a `ForeignMethodDecl`, skipping the
    implicit `self` for instance methods.
  - `Context.enclosing_path` resolves `*Self` to its `L<path>;` form.

Primitive table: void→V, bool→Z, s8/u8→B, s16→S, u16→C, s32→I,
s64→J, f32→F, f64→D. Arrays: `[]T` / `[*]T` / `[N]T` → `[<elem>`.
`*Self` → `L<enclosing>;`. Cross-class `*Foo` → explicit
`CrossClassRefNotYetSupported` error (lands in step 2.9 with the
ForeignClassDecl registry lookup).

Tests in `src/ir/jni_descriptor.test.zig`: primitive table coverage,
void-on-null, *Self, slice, cross-class-fail-fast, plus three
deriveMethod scenarios (instance, static, multi-param, slice param).

Step 2.8 is internal compiler work — derivation isn't observable at
the sx surface until call-site lowering at step 2.11. The cadence
rule's xfail-then-green pattern presupposes a snapshot harness that
doesn't apply to internal-only functions; the rule re-applies at
2.11 where end-to-end observation returns.

zig build test passes; 126/126 examples still green.
2026-05-20 10:24:12 +03:00

57 lines
1.9 KiB
Zig

pub const types = @import("types.zig");
pub const inst = @import("inst.zig");
pub const module = @import("module.zig");
pub const print = @import("print.zig");
pub const interp = @import("interp.zig");
pub const lower = @import("lower.zig");
pub const TypeId = types.TypeId;
pub const TypeInfo = types.TypeInfo;
pub const TypeTable = types.TypeTable;
pub const StringId = types.StringId;
pub const StringPool = types.StringPool;
pub const Ref = inst.Ref;
pub const BlockId = inst.BlockId;
pub const FuncId = inst.FuncId;
pub const GlobalId = inst.GlobalId;
pub const Inst = inst.Inst;
pub const Op = inst.Op;
pub const Block = inst.Block;
pub const Function = inst.Function;
pub const Global = inst.Global;
pub const ConstantValue = inst.ConstantValue;
pub const Module = module.Module;
pub const Builder = module.Builder;
pub const ImplTable = module.ImplTable;
pub const printModule = print.printModule;
pub const Interpreter = interp.Interpreter;
pub const Value = interp.Value;
pub const Lowering = lower.Lowering;
pub const compiler_hooks = @import("compiler_hooks.zig");
pub const emit_llvm = @import("emit_llvm.zig");
pub const LLVMEmitter = emit_llvm.LLVMEmitter;
pub const type_bridge = @import("type_bridge.zig");
pub const resolveAstType = type_bridge.resolveAstType;
pub const bridgeType = type_bridge.bridgeType;
pub const jni_descriptor = @import("jni_descriptor.zig");
pub const types_tests = @import("types.test.zig");
pub const inst_tests = @import("inst.test.zig");
pub const module_tests = @import("module.test.zig");
pub const print_tests = @import("print.test.zig");
pub const interp_tests = @import("interp.test.zig");
pub const lower_tests = @import("lower.test.zig");
pub const type_bridge_tests = @import("type_bridge.test.zig");
pub const emit_llvm_tests = @import("emit_llvm.test.zig");
pub const jni_descriptor_tests = @import("jni_descriptor.test.zig");
test {
@import("std").testing.refAllDecls(@This());
}