ffi 2.1: parser accepts Foo :: #jni_class("path") { } opaque form

New `hash_jni_class` token + lexer entry, `JniClassDecl` AST node
(alias + java path; body deferred to 2.2+), `parseJniClassDecl`
consuming `("...") { }` and rejecting non-empty bodies for now.
Sema registers the alias as a type_alias symbol; LSP classifies
the directive as a keyword. The 2.0 xfail snapshot flips to
`parse-only ok`, exit 0.

120/120 examples green; zig test clean.
This commit is contained in:
agra
2026-05-20 09:24:14 +03:00
parent 4c670e66f3
commit 32b464e959
8 changed files with 48 additions and 2 deletions

View File

@@ -907,6 +907,9 @@ pub const Analyzer = struct {
}
}
},
.jni_class_decl => |jd| {
try self.addSymbol(jd.name, .type_alias, null, node.span);
},
.impl_block => |ib| {
// Each impl block gets its own scope so methods don't conflict across impls
try self.pushScope();
@@ -1306,6 +1309,7 @@ pub fn findNodeAtOffset(node: *Node, offset: u32) ?*Node {
.tuple_type_expr,
.ufcs_alias,
.closure_type_expr,
.jni_class_decl,
=> {},
.struct_decl => |sd| {
for (sd.methods) |method_node| {