diff --git a/crates/fuse-parser/src/parsers/binding.rs b/crates/fuse-parser/src/parsers/binding.rs index 57ee03f..e6335c5 100644 --- a/crates/fuse-parser/src/parsers/binding.rs +++ b/crates/fuse-parser/src/parsers/binding.rs @@ -28,7 +28,7 @@ impl<'a> Parser<'a> { } fn parse_binding_identifier_pattern(&mut self) -> ParserResult { - if !self.cur_kind().is_valid_identifier() { + if !self.cur_kind().is_valid_identifier() && !self.at(TokenKind::Mut) { return Err(Self::unexpected_error(self.cur_token())); } @@ -38,13 +38,12 @@ impl<'a> Parser<'a> { pub(crate) fn parse_binding_identifier(&mut self) -> BindingIdentifier { let mut span = self.start_span(); + let mutable = self.consume_if(TokenKind::Mut).is_some(); let token = self.consume(); let name = self.view_token(*token); span = self.end_span(span); - let mutable = self.consume_if(TokenKind::Mut).is_some(); - let atom = self.ast.atom(name); self.ast.binding_identifier(span, atom, mutable)