Skip to content

Commit d3ca074

Browse files
Merge pull request #8161 from dotty-staging/fix-comments-and-identation
Fix comments and indentation
2 parents bfcd406 + 864aae5 commit d3ca074

File tree

3 files changed

+366
-331
lines changed

3 files changed

+366
-331
lines changed

compiler/src/dotty/tools/dotc/tastyreflect/ReflectionCompilerInterface.scala

Lines changed: 74 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,21 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
3030
def rootPosition: util.SourcePosition =
3131
tastyreflect.MacroExpansion.position.getOrElse(SourcePosition(rootContext.source, Spans.NoSpan))
3232

33-
//
34-
// QUOTE UNPICKLING
35-
//
33+
34+
//////////////////////
35+
// QUOTE UNPICKLING //
36+
//////////////////////
3637

3738
def unpickleExpr(repr: Unpickler.PickledQuote, args: Unpickler.PickledExprArgs): scala.quoted.Expr[?] =
3839
new TastyTreeExpr(PickledQuotes.unpickleExpr(repr, args), compilerId)
3940

4041
def unpickleType(repr: Unpickler.PickledQuote, args: Unpickler.PickledTypeArgs): scala.quoted.Type[?] =
4142
new TreeType(PickledQuotes.unpickleType(repr, args), compilerId)
4243

43-
//
44-
// CONTEXT
45-
//
44+
45+
/////////////
46+
// CONTEXT //
47+
/////////////
4648

4749
type Context = core.Contexts.Context
4850

@@ -64,9 +66,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
6466
def Context_requiredModule(self: Context)(path: String): Symbol = self.requiredModule(path)
6567
def Context_requiredMethod(self: Context)(path: String): Symbol = self.requiredMethod(path)
6668

67-
//
68-
// REPORTING
69-
//
69+
70+
///////////////
71+
// REPORTING //
72+
///////////////
7073

7174
def error(msg: => String, pos: Position)(given ctx: Context): Unit =
7275
ctx.error(msg, pos)
@@ -80,17 +83,19 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
8083
def warning(msg: => String, sourceFile: SourceFile, start: Int, end: Int)(given ctx: Context): Unit =
8184
ctx.error(msg, util.SourcePosition(sourceFile, util.Spans.Span(start, end)))
8285

83-
//
84-
// Settings
85-
//
86+
87+
//////////////
88+
// Settings //
89+
//////////////
8690

8791
type Settings = config.ScalaSettings
8892

8993
def Settings_color(self: Settings): Boolean = self.color.value(rootContext) == "always"
9094

91-
//
92-
// TREES
93-
//
95+
96+
///////////
97+
// TREES //
98+
///////////
9499

95100
type Tree = tpd.Tree
96101

@@ -1094,9 +1099,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
10941099
def Tree_Alternatives_module_copy(original: Tree)(patterns: List[Tree])(given Context): Alternatives =
10951100
tpd.cpy.Alternative(original)(patterns)
10961101

1097-
//
1098-
// TYPES
1099-
//
1102+
1103+
/////////////
1104+
// TYPES //
1105+
/////////////
11001106

11011107
type TypeOrBounds = Types.Type
11021108

@@ -1479,9 +1485,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
14791485
self.newParamRef(idx)
14801486
def TypeLambda_resType(self: TypeLambda)(given Context): Type = self.resType
14811487

1482-
//
1483-
// IMPORT SELECTORS
1484-
//
1488+
1489+
//////////////////////
1490+
// IMPORT SELECTORS //
1491+
//////////////////////
14851492

14861493
type ImportSelector = untpd.ImportSelector
14871494

@@ -1527,19 +1534,21 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
15271534
def SimpleSelector_omitted(self: OmitSelector)(given Context): Id =
15281535
self.imported
15291536

1530-
//
1531-
// IDENTIFIERS
1532-
//
1537+
1538+
/////////////////
1539+
// IDENTIFIERS //
1540+
/////////////////
15331541

15341542
type Id = untpd.Ident
15351543

15361544
def Id_pos(self: Id)(given Context): Position = self.sourcePos
15371545

15381546
def Id_name(self: Id)(given Context): String = self.name.toString
15391547

1540-
//
1541-
// SIGNATURES
1542-
//
1548+
1549+
////////////////
1550+
// SIGNATURES //
1551+
////////////////
15431552

15441553
type Signature = core.Signature
15451554

@@ -1554,9 +1563,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
15541563
def Signature_resultSig(self: Signature): String =
15551564
self.resSig.toString
15561565

1557-
//
1558-
// POSITIONS
1559-
//
1566+
1567+
///////////////
1568+
// POSITIONS //
1569+
///////////////
15601570

15611571
type Position = util.SourcePosition
15621572

@@ -1579,29 +1589,32 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
15791589
def Position_sourceCode(self: Position): String =
15801590
new String(self.source.content(), self.start, self.end - self.start)
15811591

1582-
//
1583-
// SOURCE FILES
1584-
//
1592+
1593+
//////////////////
1594+
// SOURCE FILES //
1595+
//////////////////
15851596

15861597
type SourceFile = util.SourceFile
15871598

15881599
def SourceFile_jpath(self: SourceFile): java.nio.file.Path = self.file.jpath
15891600

15901601
def SourceFile_content(self: SourceFile): String = new String(self.content())
15911602

1592-
//
1593-
// COMMENTS
1594-
//
1603+
1604+
//////////////
1605+
// COMMENTS //
1606+
//////////////
15951607

15961608
type Comment = core.Comments.Comment
15971609

15981610
def Comment_raw(self: Comment): String = self.raw
15991611
def Comment_expanded(self: Comment): Option[String] = self.expanded
16001612
def Comment_usecases(self: Comment): List[(String, Option[DefDef])] = self.usecases.map { uc => (uc.code, uc.tpdCode) }
16011613

1602-
//
1603-
// CONSTANTS
1604-
//
1614+
1615+
///////////////
1616+
// CONSTANTS //
1617+
///////////////
16051618

16061619
type Constant = Constants.Constant
16071620

@@ -1618,9 +1631,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
16181631

16191632
def Constant_ClassTag_apply(x: Type): Constant = Constants.Constant(x)
16201633

1621-
//
1622-
// SYMBOLS
1623-
//
1634+
1635+
/////////////
1636+
// SYMBOLS //
1637+
/////////////
16241638

16251639
type Symbol = core.Symbols.Symbol
16261640

@@ -1768,9 +1782,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
17681782

17691783
def Symbol_noSymbol(given ctx: Context): Symbol = core.Symbols.NoSymbol
17701784

1771-
//
1772-
// FLAGS
1773-
//
1785+
1786+
///////////
1787+
// FLAGS //
1788+
///////////
17741789

17751790
type Flags = core.Flags.FlagSet
17761791

@@ -1820,9 +1835,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
18201835
def Flags_PrivateLocal: Flags = core.Flags.PrivateLocal
18211836
def Flags_Package: Flags = core.Flags.Package
18221837

1823-
//
1824-
// QUOTED SEAL/UNSEAL
1825-
//
1838+
1839+
////////////////////////
1840+
// QUOTED SEAL/UNSEAL //
1841+
////////////////////////
18261842

18271843
/** View this expression `quoted.Expr[?]` as a `Term` */
18281844
def QuotedExpr_unseal(self: scala.quoted.Expr[?])(given Context): Term =
@@ -1858,9 +1874,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
18581874
new TreeType(tpd.TypeTree(self).withSpan(dummySpan), compilerId)
18591875
}
18601876

1861-
//
1862-
// DEFINITIONS
1863-
//
1877+
/////////////////
1878+
// DEFINITIONS //
1879+
/////////////////
18641880

18651881
// Symbols
18661882

@@ -1937,9 +1953,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
19371953
def Definitions_NullType: Type = defn.NullType
19381954
def Definitions_StringType: Type = defn.StringType
19391955

1940-
//
1941-
// IMPLICITS
1942-
//
1956+
1957+
///////////////
1958+
// IMPLICITS //
1959+
///////////////
19431960

19441961
type ImplicitSearchResult = Tree
19451962

@@ -2033,9 +2050,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
20332050
seq(argVals, rec(fn))
20342051
}
20352052

2036-
//
2037-
// HELPERS
2038-
//
2053+
/////////////
2054+
// HELPERS //
2055+
/////////////
20392056

20402057
private def optional[T <: Trees.Tree[?]](tree: T): Option[tree.type] =
20412058
if (tree.isEmpty) None else Some(tree)

0 commit comments

Comments
 (0)