ffi 2.4 green: #extends and #implements body items

Two new lexer tokens `hash_extends` / `hash_implements` (global tokens,
context-meaningful inside #jni_class bodies — same pattern as #using).
`JniClassDecl.methods` refactored into `members: []const JniClassMember`,
a tagged union with `method` / `extends` / `implements` variants.
Body loop dispatches on the leading token: `#extends Alias;` /
`#implements Alias;` consume the alias name and push a non-method
member; everything else falls through to the existing method path.

The alias on the right of `#extends` is the sx-side name (resolved
to the corresponding #jni_class at sema time in a later step), not
the foreign Java path — the path lives only in the alias's own
directive arg.

123/123 examples green.
This commit is contained in:
agra
2026-05-20 10:02:56 +03:00
parent e225adbd1c
commit a5c6f754a8
7 changed files with 37 additions and 8 deletions

View File

@@ -541,10 +541,16 @@ pub const JniMethodDecl = struct {
is_static: bool = false, // true for `static name :: ...`
};
pub const JniClassMember = union(enum) {
method: JniMethodDecl,
extends: []const u8, // sx-side alias name (right of `#extends`)
implements: []const u8, // sx-side alias name (right of `#implements`)
};
pub const JniClassDecl = struct {
name: []const u8, // sx-side alias (left of `::`)
java_path: []const u8, // directive arg, e.g. "java/path/Foo"
methods: []const JniMethodDecl = &.{}, // instance methods (static/fields/extends land in later steps)
members: []const JniClassMember = &.{}, // methods, #extends, #implements (fields/#desc land in 2.5+)
};
pub const ImplBlock = struct {