Skip to content

Commit

Permalink
fix(biome_graphql_parser): prevent empty interface list in implement …
Browse files Browse the repository at this point in the history
…clause (#2776)
  • Loading branch information
vohoanglong0107 committed May 10, 2024
1 parent 5088667 commit 49cace8
Show file tree
Hide file tree
Showing 5 changed files with 726 additions and 623 deletions.
11 changes: 8 additions & 3 deletions crates/biome_graphql_parser/src/parser/definitions/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use biome_graphql_syntax::{
T,
};
use biome_parser::parse_lists::ParseNodeList;
use biome_parser::prelude::TokenSource;
use biome_parser::{
parse_lists::ParseSeparatedList, parse_recovery::ParseRecovery, parsed_syntax::ParsedSyntax,
prelude::ParsedSyntax::*, Parser,
Expand Down Expand Up @@ -53,12 +54,16 @@ pub(super) fn parse_implements_interface(p: &mut GraphqlParser) -> ParsedSyntax

p.bump(T![implements]);

if p.at(T![&]) {
p.bump(T![&]);
}
// & is optional
p.eat(T![&]);

let position = p.source().position();
ImplementsInterfaceList.parse_list(p);

if position == p.source().position() {
p.error(expected_named_type(p, p.cur_range()));
}

Present(m.complete(p, GRAPHQL_IMPLEMENTS_INTERFACES))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ inter Person

interface Person implemets Character

interface Person implements &

interface Person @

interface Person implents Character @
Expand Down

0 comments on commit 49cace8

Please sign in to comment.