ffi 2.2 green: parser collects #jni_class instance method body items
New `JniMethodDecl` AST struct (name, params, param_names, return_type — no body, foreign declaration). `JniClassDecl.body` becomes `methods: []const JniMethodDecl`. parseJniClassDecl loops over body items, parsing each `name :: (self: *Self, args...) -> Ret;` similarly to parseProtocolDecl but requiring `;` (no body brace). `static`, fields, `#extends`, `#implements`, and the other six directive forms land in 2.3–2.7. Sema/lower still treat the decl as an opaque type alias — descriptor derivation arrives in 2.8+. 121/121 examples green.
This commit is contained in:
@@ -533,10 +533,17 @@ pub const ProtocolDecl = struct {
|
||||
type_params: []const StructTypeParam = &.{}, // for `protocol(Target: Type) { ... }`
|
||||
};
|
||||
|
||||
pub const JniMethodDecl = struct {
|
||||
name: []const u8,
|
||||
params: []const *Node, // type_expr nodes — first is `*Self` for instance methods
|
||||
param_names: []const []const u8,
|
||||
return_type: ?*Node, // null = void
|
||||
};
|
||||
|
||||
pub const JniClassDecl = struct {
|
||||
name: []const u8, // sx-side alias (left of `::`)
|
||||
java_path: []const u8, // directive arg, e.g. "java/path/Foo"
|
||||
body: []const *Node = &.{}, // body items (methods, fields, #extends, ...) — empty in 2.1
|
||||
methods: []const JniMethodDecl = &.{}, // instance methods (static/fields/extends land in later steps)
|
||||
};
|
||||
|
||||
pub const ImplBlock = struct {
|
||||
|
||||
Reference in New Issue
Block a user