File tree Expand file tree Collapse file tree 1 file changed +9
-10
lines changed
compiler/src/dotty/tools/dotc/parsing Expand file tree Collapse file tree 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -365,18 +365,16 @@ object Parsers {
365
365
366
366
def acceptStatSepUnlessAtEnd (stats : ListBuffer [Tree ], altEnd : Token = EOF ): Unit =
367
367
in.observeOutdented()
368
- if (! isStatSeqEnd)
369
- in.token match {
370
- case EOF =>
371
- case `altEnd` =>
372
- case SEMI | NEWLINE | NEWLINES =>
373
- in.nextToken()
374
- checkEndMarker(stats)
375
- case _ =>
368
+ in.token match
369
+ case SEMI | NEWLINE | NEWLINES =>
370
+ in.nextToken()
371
+ checkEndMarker(stats)
372
+ case `altEnd` =>
373
+ case _ =>
374
+ if ! isStatSeqEnd then
376
375
syntaxError(i " end of statement expected but ${showToken(in.token)} found " )
377
376
in.nextToken() // needed to ensure progress; otherwise we might cycle forever
378
377
accept(SEMI )
379
- }
380
378
381
379
def rewriteNotice (additionalOption : String = " " ) = {
382
380
val optionStr = if (additionalOption.isEmpty) " " else " " ++ additionalOption
@@ -1327,6 +1325,7 @@ object Parsers {
1327
1325
in.nextToken()
1328
1326
if stats.isEmpty || ! matches(stats.last) then
1329
1327
syntaxError(" misaligned end marker" , Span (start, in.lastCharOffset))
1328
+ in.token = IDENTIFIER
1330
1329
in.nextToken()
1331
1330
end checkEndMarker
1332
1331
@@ -3891,7 +3890,7 @@ object Parsers {
3891
3890
in.nextToken()
3892
3891
ts += objectDef(start, Modifiers (Package ))
3893
3892
if (in.token != EOF ) {
3894
- acceptStatSep( )
3893
+ acceptStatSepUnlessAtEnd(ts )
3895
3894
ts ++= topStatSeq()
3896
3895
}
3897
3896
}
You can’t perform that action at this time.
0 commit comments