Skip to content

Commit ff992a1

Browse files
authored
fix(js/parse): avoid consuming huge iterator (#11749)
1 parent b7e3559 commit ff992a1

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
Fixed [#11747](https://github.com/biomejs/biome/issues/11747): formatting and checking large parenthesized object expressions no longer exhibit quadratic slowdowns.

β€Žcrates/biome_parser/src/lexer.rsβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,10 @@ where
743743
// Jump right to where we've left of last time rather than going through all tokens again.
744744
let mut remaining = n - self.lookahead.non_trivia_len();
745745
let current_length = self.lookahead.all_len();
746-
let iter = self.lookahead_iter().skip(current_length);
746+
let iter = LookaheadIterator {
747+
buffered: self,
748+
nth: current_length,
749+
};
747750

748751
for item in iter {
749752
if !item.kind().is_trivia() {

0 commit comments

Comments
Β (0)