Skip to content

Commit 3b42639

Browse files
committed
Fix lookaheadIn
1 parent 8fb14ff commit 3b42639

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,12 @@ object Parsers {
432432

433433
def commaSeparated[T](part: () => T): List[T] = tokenSeparated(COMMA, part)
434434

435-
def lookaheadIn(tokens: Token*): Boolean =
436-
tokens.contains(in.lookaheadScanner.nextToken())
435+
/** Is the token following the current one in `tokens`? */
436+
def lookaheadIn(tokens: Token*): Boolean = {
437+
val lookahead = in.lookaheadScanner
438+
lookahead.nextToken()
439+
tokens.contains(lookahead.token)
440+
}
437441

438442
/* --------- OPERAND/OPERATOR STACK --------------------------------------- */
439443

0 commit comments

Comments
 (0)