Allow LineTerminator before Semicolon in `continue`
This Pull Request changes the following:
Check if there is a Semicolon after a LineTerminator is found in a `continue` statement.
@@ -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
