mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Parser: fix parsing of "public function" in release mode
`consume()` does not advance whitespace, while `peek()` does. And the `peek()` in the debug_assert meant that the behavior was different in release and debug mode. Use `expect` instead of consume as it skip over white space
This commit is contained in:
parent
aea216fb49
commit
aeed3b48fc
3 changed files with 10 additions and 10 deletions
|
@ -140,7 +140,7 @@ pub fn parse_qualified_name(p: &mut impl Parser) -> bool {
|
|||
fn parse_export(p: &mut impl Parser) -> bool {
|
||||
debug_assert_eq!(p.peek().as_str(), "export");
|
||||
let mut p = p.start_node(SyntaxKind::ExportsList);
|
||||
p.consume(); // "export"
|
||||
p.expect(SyntaxKind::Identifier); // "export"
|
||||
if p.test(SyntaxKind::LBrace) {
|
||||
loop {
|
||||
parse_export_specifier(&mut *p);
|
||||
|
@ -219,7 +219,7 @@ fn parse_export_specifier(p: &mut impl Parser) -> bool {
|
|||
fn parse_import_specifier(p: &mut impl Parser) -> bool {
|
||||
debug_assert_eq!(p.peek().as_str(), "import");
|
||||
let mut p = p.start_node(SyntaxKind::ImportSpecifier);
|
||||
p.consume(); // "import"
|
||||
p.expect(SyntaxKind::Identifier); // "import"
|
||||
if p.peek().kind != SyntaxKind::StringLiteral {
|
||||
if !parse_import_identifier_list(&mut *p) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue