@@ -39,7 +39,6 @@ import dotty.tools.dotc.core.Names.TypeName
39
39
import scala .annotation .tailrec
40
40
41
41
class DottyBackendInterface (outputDirectory : AbstractFile , val superCallsMap : Map [Symbol , Set [ClassSymbol ]])(implicit ctx : Context ) extends BackendInterface {
42
- import Symbols .{toDenot , toClassDenot }
43
42
// Dotty deviation: Need to (re-)import implicit decorators here because otherwise
44
43
// they would be shadowed by the more deeply nested `symHelper` decorator.
45
44
@@ -143,7 +142,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
143
142
val externalEqualsNumNum : Symbol = defn.BoxesRunTimeModule .requiredMethod(nme.equalsNumNum)
144
143
val externalEqualsNumChar : Symbol = NoSymbol // ctx.requiredMethod(BoxesRunTimeTypeRef, nme.equalsNumChar) // this method is private
145
144
val externalEqualsNumObject : Symbol = defn.BoxesRunTimeModule .requiredMethod(nme.equalsNumObject)
146
- val externalEquals : Symbol = defn.BoxesRunTimeClass .info.decl(nme.equals_).suchThat(toDenot(_) .info.firstParamTypes.size == 2 ).symbol
145
+ val externalEquals : Symbol = defn.BoxesRunTimeClass .info.decl(nme.equals_).suchThat(_ .info.firstParamTypes.size == 2 ).symbol
147
146
val MaxFunctionArity : Int = Definitions .MaxImplementedFunctionArity
148
147
val FunctionClass : Array [Symbol ] = defn.FunctionClassPerRun ()
149
148
val AbstractFunctionClass : Array [Symbol ] = defn.AbstractFunctionClassPerRun ()
@@ -214,7 +213,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
214
213
implicit val ClosureTag : ClassTag [Closure ] = ClassTag [Closure ](classOf [Closure ])
215
214
216
215
def isRuntimeVisible (annot : Annotation ): Boolean =
217
- if (toDenot( annot.atp.typeSymbol) .hasAnnotation(AnnotationRetentionAttr ))
216
+ if (annot.atp.typeSymbol.hasAnnotation(AnnotationRetentionAttr ))
218
217
retentionPolicyOf(annot) == AnnotationRetentionRuntimeAttr
219
218
else {
220
219
// SI-8926: if the annotation class symbol doesn't have a @RetentionPolicy annotation, the
@@ -264,16 +263,16 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
264
263
av.visitEnum(name, edesc, evalue)
265
264
} else {
266
265
// println(i"not an enum: ${t.symbol} / ${t.symbol.denot.owner} / ${t.symbol.denot.owner.isTerm} / ${t.symbol.denot.owner.flags}")
267
- assert(toDenot( t.symbol) .name.is(DefaultGetterName ),
268
- s " ${toDenot( t.symbol) .name.debugString}" ) // this should be default getter. do not emmit.
266
+ assert(t.symbol.name.is(DefaultGetterName ),
267
+ s " ${t.symbol.name.debugString}" ) // this should be default getter. do not emmit.
269
268
}
270
269
case t : SeqLiteral =>
271
270
val arrAnnotV : AnnotationVisitor = av.visitArray(name)
272
271
for (arg <- t.elems) { emitArgument(arrAnnotV, null , arg, bcodeStore)(innerClasesStore) }
273
272
arrAnnotV.visitEnd()
274
273
275
274
case Apply (fun, args) if fun.symbol == defn.ArrayClass .primaryConstructor ||
276
- toDenot( fun.symbol) .owner == defn.ArrayClass .linkedClass && fun.symbol.name == nme_apply =>
275
+ fun.symbol.owner == defn.ArrayClass .linkedClass && fun.symbol.name == nme_apply =>
277
276
val arrAnnotV : AnnotationVisitor = av.visitArray(name)
278
277
279
278
var actualArgs = if (fun.tpe.isImplicitMethod) {
@@ -655,29 +654,29 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
655
654
def fullName (sep : Char ): String = sym.showFullName
656
655
def fullName : String = sym.showFullName
657
656
def simpleName : Name = sym.name
658
- def javaSimpleName : String = toDenot( sym) .name.mangledString // addModuleSuffix(simpleName.dropLocal)
657
+ def javaSimpleName : String = sym.name.mangledString // addModuleSuffix(simpleName.dropLocal)
659
658
def javaBinaryName : String = javaClassName.replace('.' , '/' ) // TODO: can we make this a string? addModuleSuffix(fullNameInternal('/'))
660
- def javaClassName : String = toDenot( sym) .fullName.mangledString // addModuleSuffix(fullNameInternal('.')).toString
659
+ def javaClassName : String = sym.fullName.mangledString // addModuleSuffix(fullNameInternal('.')).toString
661
660
def name : Name = sym.name
662
661
def rawname : String = {
663
- val original = toDenot( sym) .initial
662
+ val original = sym.initial
664
663
sym.name(ctx.withPhase(original.validFor.phaseId)).mangledString
665
664
}
666
665
667
666
// types
668
- def info : Type = toDenot( sym) .info
669
- def tpe : Type = toDenot( sym) .info // todo whats the differentce between tpe and info?
670
- def thisType : Type = toDenot( sym) .thisType
667
+ def info : Type = sym.info
668
+ def tpe : Type = sym.info // todo whats the differentce between tpe and info?
669
+ def thisType : Type = sym.thisType
671
670
672
671
// tests
673
672
def isClass : Boolean = {
674
673
sym.isPackageObject || (sym.isClass)
675
674
}
676
675
def isType : Boolean = sym.isType
677
- def isAnonymousClass : Boolean = toDenot( sym) .isAnonymousClass
678
- def isConstructor : Boolean = toDenot( sym) .isConstructor
676
+ def isAnonymousClass : Boolean = sym.isAnonymousClass
677
+ def isConstructor : Boolean = sym.isConstructor
679
678
def isExpanded : Boolean = sym.name.is(ExpandedName )
680
- def isAnonymousFunction : Boolean = toDenot( sym) .isAnonymousFunction
679
+ def isAnonymousFunction : Boolean = sym.isAnonymousFunction
681
680
def isMethod : Boolean = sym is Flags .Method
682
681
def isPublic : Boolean = sym.flags.is(Flags .EmptyFlags , Flags .Private | Flags .Protected )
683
682
def isSynthetic : Boolean = sym is Flags .Synthetic
@@ -689,22 +688,22 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
689
688
def hasPackageFlag : Boolean = sym is Flags .Package
690
689
def isImplClass : Boolean = sym is Flags .ImplClass
691
690
def isInterface : Boolean = (sym is Flags .PureInterface ) || (sym is Flags .Trait )
692
- def isGetter : Boolean = toDenot( sym) .isGetter
693
- def isSetter : Boolean = toDenot( sym) .isSetter
691
+ def isGetter : Boolean = sym.isGetter
692
+ def isSetter : Boolean = sym.isSetter
694
693
def isGetClass : Boolean = sym eq defn.Any_getClass
695
694
def isJavaDefined : Boolean = sym is Flags .JavaDefined
696
- def isJavaDefaultMethod : Boolean = ! ((sym is Flags .Deferred ) || toDenot( sym) .isClassConstructor)
695
+ def isJavaDefaultMethod : Boolean = ! ((sym is Flags .Deferred ) || sym.isClassConstructor)
697
696
def isDeferred : Boolean = sym is Flags .Deferred
698
697
def isPrivate : Boolean = sym is Flags .Private
699
698
def getsJavaFinalFlag : Boolean =
700
- isFinal && ! toDenot( sym) .isClassConstructor && ! (sym is Flags .Mutable ) && ! (sym.enclosingClass is Flags .Trait )
699
+ isFinal && ! sym.isClassConstructor && ! (sym is Flags .Mutable ) && ! (sym.enclosingClass is Flags .Trait )
701
700
702
701
def getsJavaPrivateFlag : Boolean =
703
702
isPrivate // || (sym.isPrimaryConstructor && sym.owner.isTopLevelModuleClass)
704
703
705
704
def isFinal : Boolean = sym is Flags .Final
706
705
def isStaticMember : Boolean = (sym ne NoSymbol ) &&
707
- ((sym is Flags .JavaStatic ) || (owner is Flags .ImplClass ) || toDenot( sym) .hasAnnotation(ctx.definitions.ScalaStaticAnnot ))
706
+ ((sym is Flags .JavaStatic ) || (owner is Flags .ImplClass ) || sym.hasAnnotation(ctx.definitions.ScalaStaticAnnot ))
708
707
// guard against no sumbol cause this code is executed to select which call type(static\dynamic) to use to call array.clone
709
708
710
709
def isBottomClass : Boolean = (sym ne defn.NullClass ) && (sym ne defn.NothingClass )
@@ -720,12 +719,12 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
720
719
def hasModuleFlag : Boolean = sym is Flags .Module
721
720
def isSynchronized : Boolean = sym is Flags .Synchronized
722
721
def isNonBottomSubClass (other : Symbol ): Boolean = sym.derivesFrom(other)
723
- def hasAnnotation (ann : Symbol ): Boolean = toDenot( sym) .hasAnnotation(ann)
722
+ def hasAnnotation (ann : Symbol ): Boolean = sym.hasAnnotation(ann)
724
723
def shouldEmitForwarders : Boolean =
725
724
(sym is Flags .Module ) && ! (sym is Flags .ImplClass ) && sym.isStatic
726
725
def isJavaEntryPoint : Boolean = CollectEntryPoints .isJavaEntryPoint(sym)
727
726
728
- def isClassConstructor : Boolean = toDenot( sym) .isClassConstructor
727
+ def isClassConstructor : Boolean = sym.isClassConstructor
729
728
730
729
/**
731
730
* True for module classes of modules that are top-level or owned only by objects. Module classes
@@ -736,33 +735,33 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
736
735
// scalac uses atPickling here
737
736
// this would not work if modules are created after pickling
738
737
// for example by specialization
739
- val original = toDenot( sym) .initial
738
+ val original = sym.initial
740
739
val validity = original.validFor
741
740
val shiftedContext = ctx.withPhase(validity.phaseId)
742
- toDenot( sym) (shiftedContext).isStatic(shiftedContext)
741
+ sym.denot (shiftedContext).isStatic(shiftedContext)
743
742
}
744
743
745
744
def isStaticConstructor : Boolean = (isStaticMember && isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR )
746
745
747
746
748
747
// navigation
749
- def owner : Symbol = toDenot( sym) .owner
748
+ def owner : Symbol = sym.owner
750
749
def rawowner : Symbol = {
751
750
originalOwner
752
751
}
753
752
def originalOwner : Symbol =
754
753
// used to populate the EnclosingMethod attribute.
755
754
// it is very tricky in presence of classes(and annonymous classes) defined inside supper calls.
756
755
if (sym.exists) {
757
- val original = toDenot( sym) .initial
756
+ val original = sym.initial
758
757
val validity = original.validFor
759
758
val shiftedContext = ctx.withPhase(validity.phaseId)
760
- val r = toDenot( sym) (shiftedContext).maybeOwner.lexicallyEnclosingClass(shiftedContext)
759
+ val r = sym.denot (shiftedContext).maybeOwner.lexicallyEnclosingClass(shiftedContext)
761
760
r
762
761
} else NoSymbol
763
- def parentSymbols : List [Symbol ] = toDenot( sym) .info.parents.map(_.typeSymbol)
762
+ def parentSymbols : List [Symbol ] = sym.info.parents.map(_.typeSymbol)
764
763
def superClass : Symbol = {
765
- val t = toDenot( sym) .asClass.superClass
764
+ val t = sym.asClass.superClass
766
765
if (t.exists) t
767
766
else if (sym is Flags .ModuleClass ) {
768
767
// workaround #371
@@ -772,23 +771,23 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
772
771
}
773
772
else t
774
773
}
775
- def enclClass : Symbol = toDenot( sym) .enclosingClass
774
+ def enclClass : Symbol = sym.enclosingClass
776
775
def linkedClassOfClass : Symbol = linkedClass
777
- def linkedClass : Symbol = toDenot( sym)(ctx) .linkedClass(ctx) // exitingPickler(sym.linkedClassOfClass)
778
- def companionClass : Symbol = toDenot( sym) .companionClass
779
- def companionModule : Symbol = toDenot( sym) .companionModule
776
+ def linkedClass : Symbol = sym.linkedClass(ctx) // exitingPickler(sym.linkedClassOfClass)
777
+ def companionClass : Symbol = sym.companionClass
778
+ def companionModule : Symbol = sym.companionModule
780
779
def companionSymbol : Symbol = if (sym is Flags .Module ) companionClass else companionModule
781
- def moduleClass : Symbol = toDenot( sym) .moduleClass
780
+ def moduleClass : Symbol = sym.moduleClass
782
781
def enclosingClassSym : Symbol = {
783
782
if (this .isClass) {
784
783
val ct = ctx.withPhase(ctx.flattenPhase.prev)
785
- toDenot( sym) (ct).owner.enclosingClass(ct)
784
+ sym.denot (ct).owner.enclosingClass(ct)
786
785
}
787
786
else sym.enclosingClass(ctx.withPhase(ctx.flattenPhase.prev))
788
787
} // todo is handled specially for JavaDefined symbols in scalac
789
788
790
789
// members
791
- def primaryConstructor : Symbol = toDenot( sym) .primaryConstructor
790
+ def primaryConstructor : Symbol = sym.primaryConstructor
792
791
793
792
/** For currently compiled classes: All locally defined classes including local classes.
794
793
* The empty list for classes that are not currently compiled.
@@ -803,22 +802,22 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
803
802
private def definedClasses (phase : Phase ) =
804
803
if (sym.isDefinedInCurrentRun)
805
804
ctx.atPhase(phase) { implicit ctx =>
806
- toDenot( sym) .info.decls.filter(_.isClass)
805
+ sym.info.decls.filter(_.isClass)
807
806
}
808
807
else Nil
809
808
810
- def annotations : List [Annotation ] = toDenot( sym) .annotations
809
+ def annotations : List [Annotation ] = sym.annotations
811
810
def companionModuleMembers : List [Symbol ] = {
812
811
// phase travel to exitingPickler: this makes sure that memberClassesOf only sees member classes,
813
812
// not local classes of the companion module (E in the exmaple) that were lifted by lambdalift.
814
813
if (linkedClass.isTopLevelModuleClass) /* exitingPickler*/ linkedClass.memberClasses
815
814
else Nil
816
815
}
817
816
def fieldSymbols : List [Symbol ] = {
818
- toDenot( sym) .info.decls.filter(p => p.isTerm && ! p.is(Flags .Method ))
817
+ sym.info.decls.filter(p => p.isTerm && ! p.is(Flags .Method ))
819
818
}
820
819
def methodSymbols : List [Symbol ] =
821
- for (f <- toDenot( sym) .info.decls.toList if f.isMethod && f.isTerm && ! f.isModule) yield f
820
+ for (f <- sym.info.decls.toList if f.isMethod && f.isTerm && ! f.isModule) yield f
822
821
def serialVUID : Option [Long ] = None
823
822
824
823
@@ -842,7 +841,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
842
841
def superInterfaces : List [Symbol ] = {
843
842
val directlyInheritedTraits = decorateSymbol(sym).directlyInheritedTraits
844
843
val directlyInheritedTraitsSet = directlyInheritedTraits.toSet
845
- val allBaseClasses = directlyInheritedTraits.iterator.flatMap(_.symbol.asClass. baseClasses.drop(1 )).toSet
844
+ val allBaseClasses = directlyInheritedTraits.iterator.flatMap(_.baseClasses.drop(1 )).toSet
846
845
val superCalls = superCallsMap.getOrElse(sym, Set .empty)
847
846
val additional = (superCalls -- directlyInheritedTraitsSet).filter(_.is(Flags .Trait ))
848
847
// if (additional.nonEmpty)
@@ -856,7 +855,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
856
855
*/
857
856
def isTopLevelModuleClass : Boolean = sym.isModuleClass &&
858
857
ctx.atPhase(ctx.flattenPhase) { implicit ctx =>
859
- toDenot( sym) .owner.is(Flags .PackageClass )
858
+ sym.owner.is(Flags .PackageClass )
860
859
}
861
860
862
861
/**
@@ -874,7 +873,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
874
873
def addRemoteRemoteExceptionAnnotation : Unit = ()
875
874
876
875
def samMethod (): Symbol =
877
- toDenot( sym) .info.abstractTermMembers.headOption.getOrElse(toDenot( sym) .info.member(nme.apply)).symbol
876
+ sym.info.abstractTermMembers.headOption.getOrElse(sym.info.member(nme.apply)).symbol
878
877
}
879
878
880
879
0 commit comments