chore(ffi-linkage): post-stream polish — vscode keywords + vestigial param + extension metadata
Two post-stream follow-ups flagged in CHECKPOINT-EXTERN-EXPORT.md, plus a reproducible vscode-extension packaging setup: - parser: drop the vestigial `RuntimeClassPrefix.is_extern` field and `parseRuntimeClassDecl`'s `is_extern` param. Always false since the `#foreign` token was deleted; the postfix `extern`/`export` keyword is the sole reference-vs-define decider. No behavior change (644 corpus / 442 unit). - vscode grammar: highlight `extern`/`export` as `storage.modifier.sx`. - vscode packaging: declare `@vscode/vsce` as a devDep + add `package` / `vscode:prepublish` scripts so the vsix rebuilds reproducibly (was an ambient tool). Add repository/homepage/bugs (Gitea), icon (swipelab logo, 256x256), galleryBanner, README with cover banner. Rebuilt the vsix.
This commit is contained in:
@@ -258,7 +258,7 @@ pub const Parser = struct {
|
||||
// Postfix `extern` flips that to "reference an existing class on the runtime
|
||||
// side". `#jni_main` flags the class as the launchable entry (Android Activity).
|
||||
if (self.tryParseRuntimeClassPrefix()) |prefix| {
|
||||
return self.parseRuntimeClassDecl(name, start_pos, prefix.runtime, prefix.is_extern, prefix.is_main, name_is_raw);
|
||||
return self.parseRuntimeClassDecl(name, start_pos, prefix.runtime, prefix.is_main, name_is_raw);
|
||||
}
|
||||
|
||||
// C-style union declaration
|
||||
@@ -1273,7 +1273,6 @@ pub const Parser = struct {
|
||||
|
||||
const RuntimeClassPrefix = struct {
|
||||
runtime: ast.RuntimeKind,
|
||||
is_extern: bool,
|
||||
is_main: bool,
|
||||
};
|
||||
|
||||
@@ -1285,11 +1284,9 @@ pub const Parser = struct {
|
||||
/// state untouched.
|
||||
fn tryParseRuntimeClassPrefix(self: *Parser) ?RuntimeClassPrefix {
|
||||
// Peek ahead through the optional `#jni_main` modifier to confirm a
|
||||
// runtime-class directive follows. (`is_extern` — reference vs define —
|
||||
// is decided by the POSTFIX `extern`/`export` keyword in parseRuntimeClassDecl,
|
||||
// never a prefix; it stays false here.)
|
||||
// runtime-class directive follows. (reference vs define is decided by the
|
||||
// POSTFIX `extern`/`export` keyword in parseRuntimeClassDecl, never a prefix.)
|
||||
var lookahead_idx: usize = 0;
|
||||
const is_extern = false;
|
||||
var is_main = false;
|
||||
while (true) {
|
||||
const tag = self.peekTag(lookahead_idx);
|
||||
@@ -1305,7 +1302,7 @@ pub const Parser = struct {
|
||||
// Commit: consume modifier tokens.
|
||||
var i: usize = 0;
|
||||
while (i < lookahead_idx) : (i += 1) self.advance();
|
||||
return .{ .runtime = runtime, .is_extern = is_extern, .is_main = is_main };
|
||||
return .{ .runtime = runtime, .is_main = is_main };
|
||||
}
|
||||
|
||||
fn peekTag(self: *Parser, offset: usize) Tag {
|
||||
@@ -1340,7 +1337,7 @@ pub const Parser = struct {
|
||||
};
|
||||
}
|
||||
|
||||
fn parseRuntimeClassDecl(self: *Parser, name: []const u8, start_pos: u32, runtime: ast.RuntimeKind, is_extern: bool, is_main: bool, name_is_raw: bool) anyerror!*Node {
|
||||
fn parseRuntimeClassDecl(self: *Parser, name: []const u8, start_pos: u32, runtime: ast.RuntimeKind, is_main: bool, name_is_raw: bool) anyerror!*Node {
|
||||
self.advance(); // skip directive token
|
||||
|
||||
try self.expect(.l_paren);
|
||||
@@ -1356,10 +1353,8 @@ pub const Parser = struct {
|
||||
// directive (mirrors `struct #compiler` postfix placement):
|
||||
// `… extern { … }` ⇒ reference an existing runtime class.
|
||||
// `… export { … }` ⇒ define + register a new sx class (the default).
|
||||
// Maps onto `is_extern`, threaded into the runtime_class_decl node. (The
|
||||
// passed `is_extern` is always false here — the removed prefix linkage
|
||||
// form is rejected by the caller before this point.)
|
||||
var is_extern_eff = is_extern;
|
||||
// Maps onto `is_extern`, threaded into the runtime_class_decl node.
|
||||
var is_extern_eff = false;
|
||||
if (self.current.tag == .kw_extern or self.current.tag == .kw_export) {
|
||||
is_extern_eff = self.current.tag == .kw_extern;
|
||||
self.advance();
|
||||
|
||||
Reference in New Issue
Block a user