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)?; cursor.expect((Keyword::Continue, false), "continue statement", interner)?;
let label = if let SemicolonResult::Found(tok) = cursor.peek_semicolon(interner)? { let label = if let SemicolonResult::Found(tok) = cursor.peek_semicolon(interner)? {
match tok { if let Some(token) = tok {
Some(tok) if tok.kind() == &TokenKind::Punctuator(Punctuator::Semicolon) => { if token.kind() == &TokenKind::Punctuator(Punctuator::Semicolon) {
let _next = cursor.next(interner)?; 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 None

Loading…
Cancel
Save