Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions crates/mq-lang/src/ast/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -748,27 +748,23 @@ impl<'a, 'alloc> Parser<'a, 'alloc> {
let _ = self.tokens.next();

match self.tokens.next() {
Some(t) if t.kind == TokenKind::RBracket => {
let _ = self.tokens.next(); // consume ']'

Shared::new(Node {
token_id: self.token_arena.alloc(Shared::clone(&original_token)),
expr: Shared::new(Expr::Call(
IdentWithToken::new_with_token(constants::SLICE, Some(Shared::clone(&original_token))),
smallvec![
Shared::clone(&target_node),
first_node,
Shared::new(Node {
token_id: self.token_arena.alloc(Shared::clone(&original_token)),
expr: Shared::new(Expr::Call(
IdentWithToken::new_with_token(constants::LEN, None),
smallvec![target_node],
)),
})
],
)),
})
}
Some(t) if t.kind == TokenKind::RBracket => Shared::new(Node {
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removed self.tokens.next() call was consuming the closing ] bracket. Without this consumption, the ] token remains in the token stream and may cause parsing errors in subsequent operations. The original code correctly consumed the bracket before constructing the node. This removal changes the parser's token stream state and is not just a refactoring.

Copilot uses AI. Check for mistakes.
token_id: self.token_arena.alloc(Shared::clone(&original_token)),
expr: Shared::new(Expr::Call(
IdentWithToken::new_with_token(constants::SLICE, Some(Shared::clone(&original_token))),
smallvec![
Shared::clone(&target_node),
first_node,
Shared::new(Node {
token_id: self.token_arena.alloc(Shared::clone(&original_token)),
expr: Shared::new(Expr::Call(
IdentWithToken::new_with_token(constants::LEN, None),
smallvec![target_node],
)),
})
],
)),
}),
Some(t) => {
let second_node = self.parse_expr(Shared::clone(t))?;

Expand Down
Loading