@@ -36,20 +36,6 @@ import Names.Name
3636
3737class DottyBackendInterface (val outputDirectory : AbstractFile , val superCallsMap : Map [Symbol , Set [ClassSymbol ]])(implicit val ctx : Context ) {
3838
39- private def erasureString (clazz : Class [_]): String = {
40- if (clazz.isArray) " Array[" + erasureString(clazz.getComponentType) + " ]"
41- else clazz.getName
42- }
43-
44- def requiredClass [T ](implicit evidence : ClassTag [T ]): Symbol =
45- ctx.requiredClass(erasureString(evidence.runtimeClass))
46-
47- def requiredModule [T ](implicit evidence : ClassTag [T ]): Symbol = {
48- val moduleName = erasureString(evidence.runtimeClass)
49- val className = if (moduleName.endsWith(" $" )) moduleName.dropRight(1 ) else moduleName
50- ctx.requiredModule(className)
51- }
52-
5339 private val desugared = new java.util.IdentityHashMap [Type , tpd.Select ]
5440
5541 def desugarIdentBI (i : Ident ): Option [tpd.Select ] = {
@@ -103,8 +89,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
10389 def _2 : List [Tree ] = field.elems
10490 }
10591
106-
107-
10892 abstract class DeconstructorCommon [T >: Null <: AnyRef ] {
10993 var field : T = null
11094 def get : this .type = this
@@ -116,31 +100,23 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
116100 }
117101 }
118102
103+ }
119104
105+ object DottyBackendInterface {
120106
121- private val primitiveCompilationUnits = Set (
122- " Unit.scala" ,
123- " Boolean.scala" ,
124- " Char.scala" ,
125- " Byte.scala" ,
126- " Short.scala" ,
127- " Int.scala" ,
128- " Float.scala" ,
129- " Long.scala" ,
130- " Double.scala"
131- )
132-
133- /**
134- * True if the current compilation unit is of a primitive class (scala.Boolean et al).
135- * Used only in assertions.
136- */
137- def isCompilingPrimitive = {
138- primitiveCompilationUnits(ctx.compilationUnit.source.file.name)
107+ private def erasureString (clazz : Class [_]): String = {
108+ if (clazz.isArray) " Array[" + erasureString(clazz.getComponentType) + " ]"
109+ else clazz.getName
139110 }
140111
141- }
112+ def requiredClass [T ](implicit evidence : ClassTag [T ], ctx : Context ): Symbol =
113+ ctx.requiredClass(erasureString(evidence.runtimeClass))
142114
143- object DottyBackendInterface {
115+ def requiredModule [T ](implicit evidence : ClassTag [T ], ctx : Context ): Symbol = {
116+ val moduleName = erasureString(evidence.runtimeClass)
117+ val className = if (moduleName.endsWith(" $" )) moduleName.dropRight(1 ) else moduleName
118+ ctx.requiredModule(className)
119+ }
144120
145121 extension symExtensions on (sym : Symbol ) {
146122
@@ -189,4 +165,25 @@ object DottyBackendInterface {
189165 }
190166
191167 }
168+
169+ private val primitiveCompilationUnits = Set (
170+ " Unit.scala" ,
171+ " Boolean.scala" ,
172+ " Char.scala" ,
173+ " Byte.scala" ,
174+ " Short.scala" ,
175+ " Int.scala" ,
176+ " Float.scala" ,
177+ " Long.scala" ,
178+ " Double.scala"
179+ )
180+
181+ /**
182+ * True if the current compilation unit is of a primitive class (scala.Boolean et al).
183+ * Used only in assertions.
184+ */
185+ def isCompilingPrimitive (using ctx : Context ) = {
186+ primitiveCompilationUnits(ctx.compilationUnit.source.file.name)
187+ }
188+
192189}
0 commit comments