Browse Source

Allow LineTerminator before Semicolon in `continue` (#2371)

This Pull Request changes the following:

- Check if there is a Semicolon after a LineTerminator is found in a `continue` statement.
pull/2372/head
raskad 2 years ago
parent
commit
de231df63a
  1. 13
      boa_engine/src/syntax/parser/statement/continue_stm/mod.rs

13
boa_engine/src/syntax/parser/statement/continue_stm/mod.rs

@ -62,11 +62,16 @@ where
cursor.expect((Keyword::Continue, false), "continue statement", interner)?;
let label = if let SemicolonResult::Found(tok) = cursor.peek_semicolon(interner)? {
match tok {
Some(tok) if tok.kind() == &TokenKind::Punctuator(Punctuator::Semicolon) => {
let _next = cursor.next(interner)?;
if let Some(token) = tok {
if token.kind() == &TokenKind::Punctuator(Punctuator::Semicolon) {
cursor.next(interner)?;
} else if token.kind() == &TokenKind::LineTerminator {
if let Some(token) = cursor.peek(0, interner)? {
if token.kind() == &TokenKind::Punctuator(Punctuator::Semicolon) {
cursor.next(interner)?;
}
}
}
_ => {}
}
None

Loading…
Cancel
Save