You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to diagnose it and I'm pretty sure it's a bug in the lexer, I think its because there is only a \n after the closing parenthesis.
It tries to peek for a token after the ) to check if it is =>, which would mean it is an arrow function. But in this case there is no other token ahead of it and while trying to fill the lexer's buffer something goes wrong.
// Need to check if the token after the close paren is an arrow, if so then this is an ArrowFunction
// otherwise it is an expression of the form (b).
ifletSome(t) = cursor.peek(3)? {
if t.kind() == &TokenKind::Punctuator(Punctuator::Arrow)
I have the peeking visualized below:
\n ( \n x \n ) \n ?
0 0 1 1 2 2 3 3
This seems to be the max size we expected, the ? becomes None during the fill function, but right afterwards it increments write_index, which goes back to 0 and it fails the assertion:
Activity
Razican commentedon Jan 2, 2022
One question, though. Why are you calling
drop()on the parsed result? That could cause a double drop maybe?RageKnify commentedon Jan 2, 2022
I've tried to diagnose it and I'm pretty sure it's a bug in the lexer, I think its because there is only a
\nafter the closing parenthesis.It tries to peek for a token after the
)to check if it is=>, which would mean it is an arrow function. But in this case there is no other token ahead of it and while trying to fill the lexer's buffer something goes wrong.RageKnify commentedon Jan 2, 2022
The
BufferedLexer's write_index is "overflowing"peekedcontains['\n', '(', '\n', 'x', '\n', ')', '\n']The line trying to peek is here
boa/boa/src/syntax/parser/expression/assignment/mod.rs
Lines 149 to 153 in d831ff3
I have the peeking visualized below:
This seems to be the max size we expected, the
?becomesNoneduring thefillfunction, but right afterwards it incrementswrite_index, which goes back to 0 and it fails the assertion:boa/boa/src/syntax/parser/cursor/buffered_lexer/mod.rs
Lines 136 to 141 in d831ff3
Fixed #1768
Fixed #1768
Fixed #1768 (#1820)