Skip to content

Commit 785ddcc

Browse files
oderskysmarter
authored andcommitted
Rewrite compiler files back to old syntax
Previous edits already used new syntax. Rewriting to old syntax was done automatically.
1 parent a612dbe commit 785ddcc

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1636,10 +1636,11 @@ object Parsers {
16361636
if (rewriteToOldSyntax()) revertToParens(t)
16371637
in.nextToken()
16381638
}
1639-
else
1639+
else {
16401640
in.observeIndented(noIndentAfterConditionTokens)
16411641
if (rewriteToNewSyntax(t.span))
16421642
dropParensOrBraces(t.span.start, s"${tokenString(altToken)}")
1643+
}
16431644
t
16441645
}
16451646
else {
@@ -3542,14 +3543,14 @@ object Parsers {
35423543

35433544
/** TemplateOpt = [Template]
35443545
*/
3545-
def templateOpt(constr: DefDef): Template =
3546+
def templateOpt(constr: DefDef): Template = {
35463547
possibleTemplateStart()
35473548
if (in.token == EXTENDS || isIdent(nme.derives))
35483549
template(constr)
3549-
else {
3550+
else
35503551
if (in.isNestedStart) template(constr)
35513552
else Template(constr, Nil, Nil, EmptyValDef, Nil)
3552-
}
3553+
}
35533554

35543555
/** TemplateBody ::= [nl] `{' TemplateStatSeq `}'
35553556
*/

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,14 @@ object Scanners {
547547
case _ => nextWidth
548548
}
549549

550-
if lastWidth < nextWidth
550+
if (lastWidth < nextWidth
551551
&& !unless.contains(nextToken)
552-
&& (unlessSoftKW.isEmpty || token != IDENTIFIER || name != unlessSoftKW) then
552+
&& (unlessSoftKW.isEmpty || token != IDENTIFIER || name != unlessSoftKW)) {
553553
currentRegion = Indented(nextWidth, Set(), COLONEOL, currentRegion)
554554
if (!newLineInserted) next.copyFrom(this)
555555
offset = nextOffset
556556
token = INDENT
557+
}
557558
}
558559

559560
/** - Join CASE + CLASS => CASECLASS, CASE + OBJECT => CASEOBJECT, SEMI + ELSE => ELSE, COLON + <EOL> => COLONEOL
@@ -595,7 +596,7 @@ object Scanners {
595596
lookahead()
596597
val atEOL = isAfterLineEnd
597598
reset()
598-
if colonSyntax && atEOL then token = COLONEOL
599+
if (colonSyntax && atEOL) token = COLONEOL
599600
case EOF | RBRACE =>
600601
currentRegion match {
601602
case r: Indented if !r.isOutermost =>

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,8 @@ trait Applications extends Compatibility {
890890
case err: ErrorType => cpy.Apply(tree)(fun1, proto.unforcedTypedArgs).withType(err)
891891
case TryDynamicCallType => typedDynamicApply(tree, pt)
892892
case _ =>
893-
if originalProto.isDropped then fun1
894-
else if fun1.symbol == defn.Compiletime_summonFrom then
893+
if (originalProto.isDropped) fun1
894+
else if (fun1.symbol == defn.Compiletime_summonFrom)
895895
// Special handling of `summonFrom { ... }`.
896896
// We currently cannot use a macro for that since unlike other inline methods
897897
// summonFrom needs to expand lazily. For instance, in

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,8 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
12521252
|""".stripMargin
12531253
ctx.error(msg, inlinedFrom.sourcePos)
12541254
EmptyTree
1255-
} else {
1255+
}
1256+
else {
12561257
val evaluatedSplice = Splicer.splice(body, inlinedFrom.sourcePos, MacroClassLoader.fromContext)(ctx1)
12571258

12581259
val inlinedNormailizer = new TreeMap {
@@ -1270,10 +1271,10 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
12701271
/** Return the set of symbols that are refered at level -1 by the tree and defined in the current run.
12711272
* This corresponds to the symbols that will need to be interpreted.
12721273
*/
1273-
private def macroDependencies(tree: Tree)(implicit ctx: Context) = {
1274+
private def macroDependencies(tree: Tree)(implicit ctx: Context) =
12741275
new TreeAccumulator[Set[Symbol]] {
12751276
private[this] var level = -1
1276-
override def apply(syms: Set[Symbol], tree: tpd.Tree)(implicit ctx: Context): Set[Symbol] = {
1277+
override def apply(syms: Set[Symbol], tree: tpd.Tree)(implicit ctx: Context): Set[Symbol] =
12771278
if (level != -1) foldOver(syms, tree)
12781279
else tree match {
12791280
case tree: RefTree if level == -1 && tree.symbol.isDefinedInCurrentRun && !tree.symbol.isLocal =>
@@ -1289,8 +1290,6 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(implicit ctx: Context) {
12891290
case _ =>
12901291
foldOver(syms, tree)
12911292
}
1292-
}
12931293
}.apply(Set.empty, tree)
1294-
}
12951294
}
12961295

0 commit comments

Comments
 (0)