@@ -30,19 +30,21 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
30
30
def rootPosition : util.SourcePosition =
31
31
tastyreflect.MacroExpansion .position.getOrElse(SourcePosition (rootContext.source, Spans .NoSpan ))
32
32
33
- //
34
- // QUOTE UNPICKLING
35
- //
33
+
34
+ // ////////////////////
35
+ // QUOTE UNPICKLING //
36
+ // ////////////////////
36
37
37
38
def unpickleExpr (repr : Unpickler .PickledQuote , args : Unpickler .PickledExprArgs ): scala.quoted.Expr [? ] =
38
39
new TastyTreeExpr (PickledQuotes .unpickleExpr(repr, args), compilerId)
39
40
40
41
def unpickleType (repr : Unpickler .PickledQuote , args : Unpickler .PickledTypeArgs ): scala.quoted.Type [? ] =
41
42
new TreeType (PickledQuotes .unpickleType(repr, args), compilerId)
42
43
43
- //
44
- // CONTEXT
45
- //
44
+
45
+ // ///////////
46
+ // CONTEXT //
47
+ // ///////////
46
48
47
49
type Context = core.Contexts .Context
48
50
@@ -64,9 +66,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
64
66
def Context_requiredModule (self : Context )(path : String ): Symbol = self.requiredModule(path)
65
67
def Context_requiredMethod (self : Context )(path : String ): Symbol = self.requiredMethod(path)
66
68
67
- //
68
- // REPORTING
69
- //
69
+
70
+ // /////////////
71
+ // REPORTING //
72
+ // /////////////
70
73
71
74
def error (msg : => String , pos : Position )(given ctx : Context ): Unit =
72
75
ctx.error(msg, pos)
@@ -80,17 +83,19 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
80
83
def warning (msg : => String , sourceFile : SourceFile , start : Int , end : Int )(given ctx : Context ): Unit =
81
84
ctx.error(msg, util.SourcePosition (sourceFile, util.Spans .Span (start, end)))
82
85
83
- //
84
- // Settings
85
- //
86
+
87
+ // ////////////
88
+ // Settings //
89
+ // ////////////
86
90
87
91
type Settings = config.ScalaSettings
88
92
89
93
def Settings_color (self : Settings ): Boolean = self.color.value(rootContext) == " always"
90
94
91
- //
92
- // TREES
93
- //
95
+
96
+ // /////////
97
+ // TREES //
98
+ // /////////
94
99
95
100
type Tree = tpd.Tree
96
101
@@ -1094,9 +1099,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1094
1099
def Tree_Alternatives_module_copy (original : Tree )(patterns : List [Tree ])(given Context ): Alternatives =
1095
1100
tpd.cpy.Alternative (original)(patterns)
1096
1101
1097
- //
1098
- // TYPES
1099
- //
1102
+
1103
+ // ///////////
1104
+ // TYPES //
1105
+ // ///////////
1100
1106
1101
1107
type TypeOrBounds = Types .Type
1102
1108
@@ -1479,9 +1485,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1479
1485
self.newParamRef(idx)
1480
1486
def TypeLambda_resType (self : TypeLambda )(given Context ): Type = self.resType
1481
1487
1482
- //
1483
- // IMPORT SELECTORS
1484
- //
1488
+
1489
+ // ////////////////////
1490
+ // IMPORT SELECTORS //
1491
+ // ////////////////////
1485
1492
1486
1493
type ImportSelector = untpd.ImportSelector
1487
1494
@@ -1527,19 +1534,21 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1527
1534
def SimpleSelector_omitted (self : OmitSelector )(given Context ): Id =
1528
1535
self.imported
1529
1536
1530
- //
1531
- // IDENTIFIERS
1532
- //
1537
+
1538
+ // ///////////////
1539
+ // IDENTIFIERS //
1540
+ // ///////////////
1533
1541
1534
1542
type Id = untpd.Ident
1535
1543
1536
1544
def Id_pos (self : Id )(given Context ): Position = self.sourcePos
1537
1545
1538
1546
def Id_name (self : Id )(given Context ): String = self.name.toString
1539
1547
1540
- //
1541
- // SIGNATURES
1542
- //
1548
+
1549
+ // //////////////
1550
+ // SIGNATURES //
1551
+ // //////////////
1543
1552
1544
1553
type Signature = core.Signature
1545
1554
@@ -1554,9 +1563,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1554
1563
def Signature_resultSig (self : Signature ): String =
1555
1564
self.resSig.toString
1556
1565
1557
- //
1558
- // POSITIONS
1559
- //
1566
+
1567
+ // /////////////
1568
+ // POSITIONS //
1569
+ // /////////////
1560
1570
1561
1571
type Position = util.SourcePosition
1562
1572
@@ -1579,29 +1589,32 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1579
1589
def Position_sourceCode (self : Position ): String =
1580
1590
new String (self.source.content(), self.start, self.end - self.start)
1581
1591
1582
- //
1583
- // SOURCE FILES
1584
- //
1592
+
1593
+ // ////////////////
1594
+ // SOURCE FILES //
1595
+ // ////////////////
1585
1596
1586
1597
type SourceFile = util.SourceFile
1587
1598
1588
1599
def SourceFile_jpath (self : SourceFile ): java.nio.file.Path = self.file.jpath
1589
1600
1590
1601
def SourceFile_content (self : SourceFile ): String = new String (self.content())
1591
1602
1592
- //
1593
- // COMMENTS
1594
- //
1603
+
1604
+ // ////////////
1605
+ // COMMENTS //
1606
+ // ////////////
1595
1607
1596
1608
type Comment = core.Comments .Comment
1597
1609
1598
1610
def Comment_raw (self : Comment ): String = self.raw
1599
1611
def Comment_expanded (self : Comment ): Option [String ] = self.expanded
1600
1612
def Comment_usecases (self : Comment ): List [(String , Option [DefDef ])] = self.usecases.map { uc => (uc.code, uc.tpdCode) }
1601
1613
1602
- //
1603
- // CONSTANTS
1604
- //
1614
+
1615
+ // /////////////
1616
+ // CONSTANTS //
1617
+ // /////////////
1605
1618
1606
1619
type Constant = Constants .Constant
1607
1620
@@ -1618,9 +1631,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1618
1631
1619
1632
def Constant_ClassTag_apply (x : Type ): Constant = Constants .Constant (x)
1620
1633
1621
- //
1622
- // SYMBOLS
1623
- //
1634
+
1635
+ // ///////////
1636
+ // SYMBOLS //
1637
+ // ///////////
1624
1638
1625
1639
type Symbol = core.Symbols .Symbol
1626
1640
@@ -1768,9 +1782,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1768
1782
1769
1783
def Symbol_noSymbol (given ctx : Context ): Symbol = core.Symbols .NoSymbol
1770
1784
1771
- //
1772
- // FLAGS
1773
- //
1785
+
1786
+ // /////////
1787
+ // FLAGS //
1788
+ // /////////
1774
1789
1775
1790
type Flags = core.Flags .FlagSet
1776
1791
@@ -1820,9 +1835,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1820
1835
def Flags_PrivateLocal : Flags = core.Flags .PrivateLocal
1821
1836
def Flags_Package : Flags = core.Flags .Package
1822
1837
1823
- //
1824
- // QUOTED SEAL/UNSEAL
1825
- //
1838
+
1839
+ // //////////////////////
1840
+ // QUOTED SEAL/UNSEAL //
1841
+ // //////////////////////
1826
1842
1827
1843
/** View this expression `quoted.Expr[?]` as a `Term` */
1828
1844
def QuotedExpr_unseal (self : scala.quoted.Expr [? ])(given Context ): Term =
@@ -1858,9 +1874,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1858
1874
new TreeType (tpd.TypeTree (self).withSpan(dummySpan), compilerId)
1859
1875
}
1860
1876
1861
- //
1862
- // DEFINITIONS
1863
- //
1877
+ // ///////////////
1878
+ // DEFINITIONS //
1879
+ // ///////////////
1864
1880
1865
1881
// Symbols
1866
1882
@@ -1937,9 +1953,10 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
1937
1953
def Definitions_NullType : Type = defn.NullType
1938
1954
def Definitions_StringType : Type = defn.StringType
1939
1955
1940
- //
1941
- // IMPLICITS
1942
- //
1956
+
1957
+ // /////////////
1958
+ // IMPLICITS //
1959
+ // /////////////
1943
1960
1944
1961
type ImplicitSearchResult = Tree
1945
1962
@@ -2033,9 +2050,9 @@ class ReflectionCompilerInterface(val rootContext: core.Contexts.Context) extend
2033
2050
seq(argVals, rec(fn))
2034
2051
}
2035
2052
2036
- //
2037
- // HELPERS
2038
- //
2053
+ // ///////////
2054
+ // HELPERS //
2055
+ // ///////////
2039
2056
2040
2057
private def optional [T <: Trees .Tree [? ]](tree : T ): Option [tree.type ] =
2041
2058
if (tree.isEmpty) None else Some (tree)
0 commit comments