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 {
365365
366366 def acceptStatSepUnlessAtEnd (stats : ListBuffer [Tree ], altEnd : Token = EOF ): Unit =
367367 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
376375 syntaxError(i " end of statement expected but ${showToken(in.token)} found " )
377376 in.nextToken() // needed to ensure progress; otherwise we might cycle forever
378377 accept(SEMI )
379- }
380378
381379 def rewriteNotice (additionalOption : String = " " ) = {
382380 val optionStr = if (additionalOption.isEmpty) " " else " " ++ additionalOption
@@ -1327,6 +1325,7 @@ object Parsers {
13271325 in.nextToken()
13281326 if stats.isEmpty || ! matches(stats.last) then
13291327 syntaxError(" misaligned end marker" , Span (start, in.lastCharOffset))
1328+ in.token = IDENTIFIER
13301329 in.nextToken()
13311330 end checkEndMarker
13321331
@@ -3891,7 +3890,7 @@ object Parsers {
38913890 in.nextToken()
38923891 ts += objectDef(start, Modifiers (Package ))
38933892 if (in.token != EOF ) {
3894- acceptStatSep( )
3893+ acceptStatSepUnlessAtEnd(ts )
38953894 ts ++= topStatSeq()
38963895 }
38973896 }
You can’t perform that action at this time.
0 commit comments