Fix support for multiple import statements from the same path (#1868)

Importing multiple types from the same file with multiple import statements would produce an error.
This commit is contained in:
Simon Hausmann 2022-11-21 15:37:38 +01:00 committed by GitHub
parent 809255ea56
commit 59d3a69688
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 63 additions and 35 deletions

View file

@ -229,7 +229,6 @@ fn parse_import_specifier(p: &mut impl Parser) -> bool {
/// ```test,ImportIdentifierList
/// { Type1 }
/// { Type2, Type3 }
/// { }
/// { Type as Alias1, Type as AnotherAlias }
/// ```
fn parse_import_identifier_list(p: &mut impl Parser) -> bool {
@ -237,8 +236,9 @@ fn parse_import_identifier_list(p: &mut impl Parser) -> bool {
if !p.expect(SyntaxKind::LBrace) {
return false;
}
if p.test(SyntaxKind::RBrace) {
return true;
if p.peek().kind == SyntaxKind::RBrace {
p.error("Import names are missing. Please specify which types you would like to import");
return false;
}
loop {
parse_import_identifier(&mut *p);