fix(selfhost/parser): skip newlines inside multi-import brace blocks

parserParseImportDecl now skips tkNewLine tokens inside {..} blocks,
matching the bootstrap parser behavior. This fixes parsing of imports
with names on separate lines, e.g.:

  import Std::String::{
      String_Eq,
      String_Len
  };

Previously the parser failed because it expected tkIdent immediately
after { but encountered tkNewLine instead.
This commit is contained in:
2026-06-08 18:56:43 +03:00
parent 38bc469be7
commit b1deff7fd5
+6
View File
@@ -1925,6 +1925,12 @@ func parserParseImportDecl(p: *Parser, isPublic: bool) -> *Decl {
discard parserAdvance(p); // {
var names: String = "";
while !parserCheck(p, tkRBrace) && parserPeek(p, 0) != tkEndOfFile {
while parserCheck(p, tkNewLine) {
discard parserAdvance(p);
}
if parserCheck(p, tkRBrace) || parserPeek(p, 0) == tkEndOfFile {
break;
}
let n: LexToken = parserExpect(p, tkIdent, "expected import name");
names = String_Concat(names, n.text);
names = String_Concat(names, ",");