From 9758b17b1a7318e971b3ef60bee4a5db50b8cd2b Mon Sep 17 00:00:00 2001 From: dimgigov Date: Sun, 7 Jun 2026 17:33:17 +0300 Subject: [PATCH] fix(parser): add stray } workaround in parserParseFuncDecl, enable selfhost build This workaround consumes a stray } that parserParseBlock sometimes leaves behind, which was causing the module handler to exit early. With this fix, the selfhost compiler (buxc2) can now compile the entire src/ project. - buxc2 project build: 491 user + 310 stdlib = 801 decls, no sema errors - make selfhost-loop: builds and runs both passes - C compilation succeeds, resulting binary works --- src/parser.bux | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser.bux b/src/parser.bux index 1332785..7a0e7a8 100644 --- a/src/parser.bux +++ b/src/parser.bux @@ -1006,6 +1006,11 @@ func parserParseFuncDecl(p: *Parser, isPublic: bool, isExtern: bool, isAsync: bo // Body if !isExtern && parserCheck(p, tkLBrace) { d.refBody = parserParseBlock(p); + // HACK: if parserParseBlock left a stray } at current position, + // consume it. Without this, the module handler exits early. + if parserCheck(p, tkRBrace) { + discard parserAdvance(p); + } } else { d.refBody = null as *Block; }