@@ -36,7 +36,8 @@ import Names.TermName
36
36
import Annotations .Annotation
37
37
import Names .Name
38
38
39
- class DottyBackendInterface (val outputDirectory : AbstractFile , val superCallsMap : Map [Symbol , Set [ClassSymbol ]])(using val ctx : Context ) {
39
+ class DottyBackendInterface (val outputDirectory : AbstractFile , val superCallsMap : Map [Symbol , Set [ClassSymbol ]])
40
+ (using val ctx : Context , val cs : CState ) {
40
41
41
42
private val desugared = new java.util.IdentityHashMap [Type , tpd.Select ]
42
43
@@ -109,36 +110,36 @@ object DottyBackendInterface {
109
110
else clazz.getName
110
111
}
111
112
112
- def requiredClass (str : String )(using Context ): ClassSymbol =
113
+ def requiredClass (str : String )(using Context , CState ): ClassSymbol =
113
114
Symbols .requiredClass(str)
114
115
115
- def requiredClass [T ](using evidence : ClassTag [T ], ctx : Context ): Symbol =
116
+ def requiredClass [T ](using evidence : ClassTag [T ], ctx : Context , cs : CState ): Symbol =
116
117
requiredClass(erasureString(evidence.runtimeClass))
117
118
118
- def requiredModule (str : String )(using Context ): Symbol =
119
+ def requiredModule (str : String )(using Context , CState ): Symbol =
119
120
Symbols .requiredModule(str)
120
121
121
- def requiredModule [T ](using evidence : ClassTag [T ], ctx : Context ): Symbol = {
122
+ def requiredModule [T ](using evidence : ClassTag [T ], ctx : Context , cs : CState ): Symbol = {
122
123
val moduleName = erasureString(evidence.runtimeClass)
123
124
val className = if (moduleName.endsWith(" $" )) moduleName.dropRight(1 ) else moduleName
124
125
requiredModule(className)
125
126
}
126
127
127
128
extension symExtensions on (sym : Symbol ) {
128
129
129
- def isInterface (using Context ): Boolean = (sym.is(PureInterface )) || sym.is(Trait )
130
+ def isInterface (using Context , CState ): Boolean = (sym.is(PureInterface )) || sym.is(Trait )
130
131
131
- def isStaticConstructor (using Context ): Boolean = (sym.isStaticMember && sym.isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR )
132
+ def isStaticConstructor (using Context , CState ): Boolean = (sym.isStaticMember && sym.isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR )
132
133
133
- def isStaticMember (using Context ): Boolean = (sym ne NoSymbol ) &&
134
+ def isStaticMember (using Context , CState ): Boolean = (sym ne NoSymbol ) &&
134
135
(sym.is(JavaStatic ) || sym.isScalaStatic)
135
136
// guard against no sumbol cause this code is executed to select which call type(static\dynamic) to use to call array.clone
136
137
137
138
/**
138
139
* True for module classes of modules that are top-level or owned only by objects. Module classes
139
140
* for such objects will get a MODULE$ flag and a corresponding static initializer.
140
141
*/
141
- def isStaticModuleClass (using Context ): Boolean =
142
+ def isStaticModuleClass (using Context , CState ): Boolean =
142
143
(sym.is(Module )) && {
143
144
// scalac uses atPickling here
144
145
// this would not work if modules are created after pickling
@@ -152,7 +153,7 @@ object DottyBackendInterface {
152
153
153
154
154
155
155
- def originalLexicallyEnclosingClass (using Context ): Symbol =
156
+ def originalLexicallyEnclosingClass (using Context , CState ): Symbol =
156
157
// used to populate the EnclosingMethod attribute.
157
158
// it is very tricky in presence of classes(and annonymous classes) defined inside supper calls.
158
159
if (sym.exists) {
@@ -166,15 +167,15 @@ object DottyBackendInterface {
166
167
* True for module classes of package level objects. The backend will generate a mirror class for
167
168
* such objects.
168
169
*/
169
- def isTopLevelModuleClass (using Context ): Boolean =
170
+ def isTopLevelModuleClass (using Context , CState ): Boolean =
170
171
sym.is(ModuleClass ) &&
171
172
atPhase(flattenPhase) {
172
173
toDenot(sym).owner.is(PackageClass )
173
174
}
174
175
175
- def javaSimpleName (using Context ): String = toDenot(sym).name.mangledString
176
- def javaClassName (using Context ): String = toDenot(sym).fullName.mangledString
177
- def javaBinaryName (using Context ): String = javaClassName.replace('.' , '/' )
176
+ def javaSimpleName (using Context , CState ): String = toDenot(sym).name.mangledString
177
+ def javaClassName (using Context , CState ): String = toDenot(sym).fullName.mangledString
178
+ def javaBinaryName (using Context , CState ): String = javaClassName.replace('.' , '/' )
178
179
}
179
180
180
181
private val primitiveCompilationUnits = Set (
@@ -193,7 +194,7 @@ object DottyBackendInterface {
193
194
* True if the current compilation unit is of a primitive class (scala.Boolean et al).
194
195
* Used only in assertions.
195
196
*/
196
- def isCompilingPrimitive (using Context ) = {
197
+ def isCompilingPrimitive (using Context , CState ) = {
197
198
primitiveCompilationUnits(ctx.compilationUnit.source.file.name)
198
199
}
199
200
0 commit comments