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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user