Skip to content

Commit 973712b

Browse files
committed
Drop Context mixins for Symbols and SymDenotations
1 parent 5cdfd31 commit 973712b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1126
-1116
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
326326
else {
327327
val arity = app.meth.tpe.widenDealias.firstParamTypes.size - env.size
328328
val returnsUnit = app.meth.tpe.widenDealias.resultType.classSymbol == defn.UnitClass
329-
if (returnsUnit) ctx.requiredClass(("dotty.runtime.function.JProcedure" + arity))
330-
else if (arity <= 2) ctx.requiredClass(("dotty.runtime.function.JFunction" + arity))
331-
else ctx.requiredClass(("scala.Function" + arity))
329+
if (returnsUnit) requiredClass(("dotty.runtime.function.JProcedure" + arity))
330+
else if (arity <= 2) requiredClass(("dotty.runtime.function.JFunction" + arity))
331+
else requiredClass(("scala.Function" + arity))
332332
}
333333
}
334334
val (fun, args) = call match {

compiler/src/dotty/tools/backend/jvm/BCodeHelpers.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
5252
def ScalaATTRName: String = "Scala"
5353
def ScalaSignatureATTRName: String = "ScalaSig"
5454

55-
@threadUnsafe lazy val AnnotationRetentionAttr: ClassSymbol = ctx.requiredClass("java.lang.annotation.Retention")
56-
@threadUnsafe lazy val AnnotationRetentionSourceAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE")
57-
@threadUnsafe lazy val AnnotationRetentionClassAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS")
58-
@threadUnsafe lazy val AnnotationRetentionRuntimeAttr: TermSymbol = ctx.requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME")
59-
@threadUnsafe lazy val JavaAnnotationClass: ClassSymbol = ctx.requiredClass("java.lang.annotation.Annotation")
55+
@threadUnsafe lazy val AnnotationRetentionAttr: ClassSymbol = requiredClass("java.lang.annotation.Retention")
56+
@threadUnsafe lazy val AnnotationRetentionSourceAttr: TermSymbol = requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("SOURCE")
57+
@threadUnsafe lazy val AnnotationRetentionClassAttr: TermSymbol = requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("CLASS")
58+
@threadUnsafe lazy val AnnotationRetentionRuntimeAttr: TermSymbol = requiredClass("java.lang.annotation.RetentionPolicy").linkedClass.requiredValue("RUNTIME")
59+
@threadUnsafe lazy val JavaAnnotationClass: ClassSymbol = requiredClass("java.lang.annotation.Annotation")
6060

6161
val bCodeAsmCommon: BCodeAsmCommon[int.type] = new BCodeAsmCommon(int)
6262
import bCodeAsmCommon._

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
388388
*/
389389
def makeLocal(tk: BType, name: String, tpe: Type, pos: Span): Symbol = {
390390

391-
val locSym = ctx.newSymbol(methSymbol, name.toTermName, Synthetic, tpe, NoSymbol, pos)
391+
val locSym = newSymbol(methSymbol, name.toTermName, Synthetic, tpe, NoSymbol, pos)
392392
makeLocal(locSym, tk)
393393
locSym
394394
}

compiler/src/dotty/tools/backend/jvm/CoreBTypes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: DottyBackendInterface]](val bTyp
114114
* names of NothingClass and NullClass can't be emitted as-is.
115115
* TODO @lry Once there's a 2.11.3 starr, use the commented argument list. The current starr crashes on the type literal `scala.runtime.Nothing$`
116116
*/
117-
lazy val RT_NOTHING : ClassBType = classBTypeFromSymbol(ctx.requiredClass("scala.runtime.Nothing$")) // (requiredClass[scala.runtime.Nothing$])
118-
lazy val RT_NULL : ClassBType = classBTypeFromSymbol(ctx.requiredClass("scala.runtime.Null$")) // (requiredClass[scala.runtime.Null$])
117+
lazy val RT_NOTHING : ClassBType = classBTypeFromSymbol(requiredClass("scala.runtime.Nothing$")) // (requiredClass[scala.runtime.Nothing$])
118+
lazy val RT_NULL : ClassBType = classBTypeFromSymbol(requiredClass("scala.runtime.Null$")) // (requiredClass[scala.runtime.Null$])
119119

120120
lazy val ObjectReference : ClassBType = classBTypeFromSymbol(defn.ObjectClass)
121121
lazy val objArrayReference : ArrayBType = ArrayBType(ObjectReference)

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,19 @@ object DottyBackendInterface {
107107
else clazz.getName
108108
}
109109

110+
def requiredClass(str: String)(using Context): ClassSymbol =
111+
Symbols.requiredClass(str)
112+
110113
def requiredClass[T](using evidence: ClassTag[T], ctx: Context): Symbol =
111-
ctx.requiredClass(erasureString(evidence.runtimeClass))
114+
requiredClass(erasureString(evidence.runtimeClass))
115+
116+
def requiredModule(str: String)(using Context): Symbol =
117+
Symbols.requiredModule(str)
112118

113119
def requiredModule[T](using evidence: ClassTag[T], ctx: Context): Symbol = {
114120
val moduleName = erasureString(evidence.runtimeClass)
115121
val className = if (moduleName.endsWith("$")) moduleName.dropRight(1) else moduleName
116-
ctx.requiredModule(className)
122+
requiredModule(className)
117123
}
118124

119125
extension symExtensions on (sym: Symbol) {

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ class JSCodeGen()(using genCtx: Context) {
17911791
private lazy val externalEqualsNumNum: Symbol =
17921792
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumNum)
17931793
private lazy val externalEqualsNumChar: Symbol =
1794-
NoSymbol // ctx.requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
1794+
NoSymbol // requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
17951795
private lazy val externalEqualsNumObject: Symbol =
17961796
defn.BoxesRunTimeModule.requiredMethod(nme.equalsNumObject)
17971797
private lazy val externalEquals: Symbol =

0 commit comments

Comments
 (0)