Skip to content

Commit f236904

Browse files
oderskyneko-kai
authored andcommitted
Drop lastOffset
1 parent 0153060 commit f236904

File tree

1 file changed

+3
-22
lines changed

1 file changed

+3
-22
lines changed

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

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,6 @@ object Parsers {
233233

234234
/* ------------- ERROR HANDLING ------------------------------------------- */
235235

236-
/** The offset of the last time when a statement on a new line was definitely
237-
* encountered in the current scope or an outer scope.
238-
*/
239-
private var lastStatOffset = -1
240-
241-
def setLastStatOffset(): Unit =
242-
if (mustStartStat && in.isAfterLineEnd)
243-
lastStatOffset = in.offset
244-
245236
/** Is offset1 less or equally indented than offset2?
246237
* This is the case if the characters between the preceding end-of-line and offset1
247238
* are a prefix of the characters between the preceding end-of-line and offset2.
@@ -533,11 +524,8 @@ object Parsers {
533524
if (in.rewriteToIndent) bracesToIndented(body, rewriteWithColon)
534525
else inBraces(body)
535526

536-
def inDefScopeBraces[T](body: => T, rewriteWithColon: Boolean = false): T = {
537-
val saved = lastStatOffset
538-
try inBracesOrIndented(body, rewriteWithColon)
539-
finally lastStatOffset = saved
540-
}
527+
def inDefScopeBraces[T](body: => T, rewriteWithColon: Boolean = false): T =
528+
inBracesOrIndented(body, rewriteWithColon)
541529

542530
/** part { `separator` part }
543531
*/
@@ -1538,10 +1526,7 @@ object Parsers {
15381526
else t
15391527

15401528
/** The block in a quote or splice */
1541-
def stagedBlock() =
1542-
val saved = lastStatOffset
1543-
try inBraces(block(simplify = true))
1544-
finally lastStatOffset = saved
1529+
def stagedBlock() = inBraces(block(simplify = true))
15451530

15461531
/** SimpleEpxr ::= spliceId | ‘$’ ‘{’ Block ‘}’)
15471532
* SimpleType ::= spliceId | ‘$’ ‘{’ Block ‘}’)
@@ -3643,7 +3628,6 @@ object Parsers {
36433628
val meths = new ListBuffer[DefDef]
36443629
val exitOnError = false
36453630
while !isStatSeqEnd && !exitOnError do
3646-
setLastStatOffset()
36473631
meths += extMethod(numLeadParams)
36483632
acceptStatSepUnlessAtEnd(meths)
36493633
if meths.isEmpty then syntaxError("`def` expected")
@@ -3782,7 +3766,6 @@ object Parsers {
37823766
def topStatSeq(outermost: Boolean = false): List[Tree] = {
37833767
val stats = new ListBuffer[Tree]
37843768
while (!isStatSeqEnd) {
3785-
setLastStatOffset()
37863769
if (in.token == PACKAGE) {
37873770
val start = in.skipToken()
37883771
if (in.token == OBJECT) {
@@ -3844,7 +3827,6 @@ object Parsers {
38443827
}
38453828
var exitOnError = false
38463829
while (!isStatSeqEnd && !exitOnError) {
3847-
setLastStatOffset()
38483830
if (in.token == IMPORT)
38493831
stats ++= importClause(IMPORT, mkImport())
38503832
else if (in.token == EXPORT)
@@ -3924,7 +3906,6 @@ object Parsers {
39243906
val stats = new ListBuffer[Tree]
39253907
var exitOnError = false
39263908
while (!isStatSeqEnd && in.token != CASE && !exitOnError) {
3927-
setLastStatOffset()
39283909
if (in.token == IMPORT)
39293910
stats ++= importClause(IMPORT, mkImport())
39303911
else if (isExprIntro)

0 commit comments

Comments
 (0)