fix(selfhost/parser): skip newlines inside expressions
The selfhost parser did not skip tkNewLine tokens inside expression parsing,
causing multi-line expressions (e.g. if conditions spanning lines with ||)
to be truncated. When parserParseBinaryPrec hit a newline it treated it as
an invalid primary, returning a malformed literal and leaving p.pos at the
newline. parserParseBlock then failed to find '{' and its depth-counter
fallback consumed far too many tokens, causing subsequent function bodies
to be parsed into the wrong AST nodes.
Fix: add newline skipping in parserParsePrimary, parserParseUnary, and
parserParseBinaryPrec, matching the bootstrap parser's skipNewlines() calls
in parseAnd/parseOr.
Also complete the variant cap raise from 8->9 in src/sema.bux (was already
done in ast.bux, parser.bux, hir_lower.bux).
This commit is contained in:
+2
-1
@@ -490,7 +490,7 @@ func Sema_CollectGlobals(sema: *Sema) {
|
||||
|
||||
// Register enum variants as constants
|
||||
var vi: int = 0;
|
||||
while vi < decl.variantCount && vi < 8 {
|
||||
while vi < decl.variantCount && vi < 9 {
|
||||
var v: EnumVariant;
|
||||
if vi == 0 { v = decl.variant0; }
|
||||
else if vi == 1 { v = decl.variant1; }
|
||||
@@ -500,6 +500,7 @@ func Sema_CollectGlobals(sema: *Sema) {
|
||||
else if vi == 5 { v = decl.variant5; }
|
||||
else if vi == 6 { v = decl.variant6; }
|
||||
else if vi == 7 { v = decl.variant7; }
|
||||
else if vi == 8 { v = decl.variant8; }
|
||||
if v.name == null as String || String_Eq(v.name, "") {
|
||||
vi = vi + 1;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user