fix(parser): replace destructive skip with single-token skip
This commit is contained in:
+4
-4
@@ -2069,10 +2069,10 @@ func parserParseDecl(p: *Parser) -> *Decl {
|
|||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip unknown declarations
|
// Unknown declaration — skip one token and return null
|
||||||
while parserPeek(p, 0) != tkEndOfFile && parserPeek(p, 0) != tkNewLine && parserPeek(p, 0) != tkRBrace {
|
// (was: skip to newline/}, which was destructive)
|
||||||
discard parserAdvance(p);
|
parserEmitDiag(p, parserCurToken(p).line, parserCurToken(p).column, "skipping unknown declaration");
|
||||||
}
|
discard parserAdvance(p);
|
||||||
return null as *Decl;
|
return null as *Decl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user