Skip to content

Commit

Permalink
fix(parser): issue in parsing mutable variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed Mar 7, 2024
1 parent 8bc3d54 commit dc0c896
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions crates/fuse-parser/src/parsers/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a> Parser<'a> {
}

fn parse_binding_identifier_pattern(&mut self) -> ParserResult<BindingPattern> {
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()));
}

Expand All @@ -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)
Expand Down

0 comments on commit dc0c896

Please sign in to comment.