@@ -116,58 +116,62 @@ object DottyBackendInterface {
116
116
ctx.requiredModule(className)
117
117
}
118
118
119
- extension symExtensions on (sym : Symbol ) {
120
-
121
- def isInterface (using Context ): Boolean = (sym.is(PureInterface )) || sym.is(Trait )
122
-
123
- def isStaticConstructor (using Context ): Boolean = (sym.isStaticMember && sym.isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR )
124
-
125
- def isStaticMember (using Context ): Boolean = (sym ne NoSymbol ) &&
126
- (sym.is(JavaStatic ) || sym.isScalaStatic)
127
- // guard against no sumbol cause this code is executed to select which call type(static\dynamic) to use to call array.clone
128
-
129
- /**
130
- * True for module classes of modules that are top-level or owned only by objects. Module classes
131
- * for such objects will get a MODULE$ flag and a corresponding static initializer.
132
- */
133
- def isStaticModuleClass (using Context ): Boolean =
134
- (sym.is(Module )) && {
135
- // scalac uses atPickling here
136
- // this would not work if modules are created after pickling
137
- // for example by specialization
138
- val original = toDenot(sym).initial
139
- val validity = original.validFor
140
- atPhase(validity.phaseId) {
141
- toDenot(sym).isStatic
119
+ given symExtensions as AnyRef :
120
+ extension (sym : Symbol ):
121
+
122
+ def isInterface (using Context ): Boolean = (sym.is(PureInterface )) || sym.is(Trait )
123
+
124
+ def isStaticConstructor (using Context ): Boolean = (sym.isStaticMember && sym.isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR )
125
+
126
+ def isStaticMember (using Context ): Boolean = (sym ne NoSymbol ) &&
127
+ (sym.is(JavaStatic ) || sym.isScalaStatic)
128
+ // guard against no sumbol cause this code is executed to select which call type(static\dynamic) to use to call array.clone
129
+
130
+ /**
131
+ * True for module classes of modules that are top-level or owned only by objects. Module classes
132
+ * for such objects will get a MODULE$ flag and a corresponding static initializer.
133
+ */
134
+ def isStaticModuleClass (using Context ): Boolean =
135
+ (sym.is(Module )) && {
136
+ // scalac uses atPickling here
137
+ // this would not work if modules are created after pickling
138
+ // for example by specialization
139
+ val original = toDenot(sym).initial
140
+ val validity = original.validFor
141
+ atPhase(validity.phaseId) {
142
+ toDenot(sym).isStatic
143
+ }
142
144
}
143
- }
144
145
145
146
146
147
147
- def originalLexicallyEnclosingClass (using Context ): Symbol =
148
- // used to populate the EnclosingMethod attribute.
149
- // it is very tricky in presence of classes(and annonymous classes) defined inside supper calls.
150
- if (sym.exists) {
151
- val validity = toDenot(sym).initial.validFor
152
- atPhase(validity.phaseId) {
153
- toDenot(sym).lexicallyEnclosingClass
148
+ def originalLexicallyEnclosingClass (using Context ): Symbol =
149
+ // used to populate the EnclosingMethod attribute.
150
+ // it is very tricky in presence of classes(and annonymous classes) defined inside supper calls.
151
+ if (sym.exists) {
152
+ val validity = toDenot(sym).initial.validFor
153
+ atPhase(validity.phaseId) {
154
+ toDenot(sym).lexicallyEnclosingClass
155
+ }
156
+ } else NoSymbol
157
+
158
+ /**
159
+ * True for module classes of package level objects. The backend will generate a mirror class for
160
+ * such objects.
161
+ */
162
+ def isTopLevelModuleClass (using Context ): Boolean =
163
+ sym.is(ModuleClass ) &&
164
+ atPhase(flattenPhase) {
165
+ toDenot(sym).owner.is(PackageClass )
154
166
}
155
- } else NoSymbol
156
-
157
- /**
158
- * True for module classes of package level objects. The backend will generate a mirror class for
159
- * such objects.
160
- */
161
- def isTopLevelModuleClass (using Context ): Boolean =
162
- sym.is(ModuleClass ) &&
163
- atPhase(flattenPhase) {
164
- toDenot(sym).owner.is(PackageClass )
165
- }
166
167
167
- def javaSimpleName (using Context ): String = toDenot(sym).name.mangledString
168
- def javaClassName (using Context ): String = toDenot(sym).fullName.mangledString
169
- def javaBinaryName (using Context ): String = javaClassName.replace('.' , '/' )
170
- }
168
+ def javaSimpleName (using Context ): String = toDenot(sym).name.mangledString
169
+ def javaClassName (using Context ): String = toDenot(sym).fullName.mangledString
170
+ def javaBinaryName (using Context ): String = javaClassName.replace('.' , '/' )
171
+
172
+ end extension
173
+
174
+ end symExtensions
171
175
172
176
private val primitiveCompilationUnits = Set (
173
177
" Unit.scala" ,
0 commit comments