Skip to content

Commit 1b2e171

Browse files
committed
Rewrite compiler to indent
1 parent 520b41d commit 1b2e171

File tree

12 files changed

+75
-76
lines changed

12 files changed

+75
-76
lines changed

compiler/src/dotty/tools/backend/jvm/CodeGen.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)(
103103
GeneratedDefs(generatedClasses.toList, generatedTasty.toList)
104104

105105
// Creates a callback that will be evaluated in PostProcessor after creating a file
106-
private def onFileCreated(cls: ClassNode, claszSymbol: Symbol, sourceFile: interfaces.SourceFile): AbstractFile => Unit = clsFile =>
106+
private def onFileCreated(cls: ClassNode, claszSymbol: Symbol, sourceFile: interfaces.SourceFile): AbstractFile => Unit = clsFile => {
107107
val (fullClassName, isLocal) = atPhase(sbtExtractDependenciesPhase):
108108
(ExtractDependencies.classNameAsString(claszSymbol), claszSymbol.isLocal)
109109

@@ -116,6 +116,7 @@ class CodeGen(val int: DottyBackendInterface, val primitives: DottyPrimitives)(
116116
val cb = ctx.sbtCallback
117117
if (isLocal) cb.generatedLocalClass(jSourceFile, clsFile.file)
118118
else cb.generatedNonLocalClass(jSourceFile, clsFile.file, className, fullClassName)
119+
}
119120

120121
/** Convert a `dotty.tools.io.AbstractFile` into a
121122
* `dotty.tools.dotc.interfaces.AbstractFile`.

compiler/src/dotty/tools/dotc/core/Comments.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ object Comments:
115115
final case class UseCase(code: String, codePos: Span, untpdCode: untpd.Tree, tpdCode: Option[tpd.DefDef]):
116116
def typed(tpdCode: tpd.DefDef): UseCase = copy(tpdCode = Some(tpdCode))
117117

118-
object UseCase {
119-
def apply(code: String, codePos: Span)(using Context): UseCase = {
120-
val tree = {
118+
object UseCase:
119+
def apply(code: String, codePos: Span)(using Context): UseCase =
120+
val tree =
121121
val tree = Parsers.parser(SourceFile.virtual("<usecase>", code)).localDef(codePos.start)
122-
tree match {
122+
tree match
123123
case tree: untpd.DefDef =>
124124
val newName = ctx.compilationUnit.freshNames.newName(tree.name, NameKinds.DocArtifactName)
125125
untpd.cpy.DefDef(tree)(name = newName)

compiler/src/dotty/tools/dotc/inlines/Inlines.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ object Inlines:
322322
ConstFold(underlyingCodeArg).tpe.widenTermRefExpr match
323323
case ConstantType(Constant(code: String)) =>
324324
val source2 = SourceFile.virtual("tasty-reflect", code)
325-
inContext(ctx.fresh.setNewTyperState().setTyper(new Typer(ctx.nestingLevel + 1)).setSource(source2)) {
325+
inContext(ctx.fresh.setNewTyperState().setTyper(new Typer(ctx.nestingLevel + 1)).setSource(source2)):
326326
val tree2 = Parsers.parser(source2).block()
327327
if ctx.reporter.allErrors.nonEmpty then
328328
ctx.reporter.allErrors.map((ErrorKind.Parser, _))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Parser extends Phase:
2626
val unit = ctx.compilationUnit
2727
unit.untpdTree =
2828
if (unit.isJava) new JavaParsers.JavaParser(unit.source).parse()
29-
else {
29+
else
3030
val p = Parsers.parser(unit.source)
3131
// p.in.debugTokenStream = true
3232
val tree = p.parse()

0 commit comments

Comments
 (0)