@@ -424,18 +424,26 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
424
424
}.bits
425
425
426
426
def isQualifierSafeToElide (qual : Tree ): Boolean = tpd.isIdempotentExpr(qual)
427
+
428
+ private val desugared = new java.util.IdentityHashMap [Type , tpd.Select ]
429
+
427
430
def desugarIdent (i : Ident ): Option [tpd.Select ] = {
428
- i.tpe match {
429
- case TermRef (prefix : TermRef , name) =>
430
- Some (tpd.ref(prefix).select(i.symbol))
431
- case TermRef (prefix : ThisType , name) =>
432
- Some (tpd.This (prefix.cls).select(i.symbol))
433
- case TermRef (NoPrefix , name) =>
434
- if (i.symbol is Flags .Method ) Some (This (i.symbol.topLevelClass).select(i.symbol)) // workaround #342 todo: remove after fixed
435
- else None
436
- case _ => None
431
+ var found = desugared.get(i.tpe)
432
+ if (found == null ) {
433
+ i.tpe match {
434
+ case TermRef (prefix : TermRef , name) =>
435
+ found = tpd.ref(prefix).select(i.symbol)
436
+ case TermRef (prefix : ThisType , name) =>
437
+ found = tpd.This (prefix.cls).select(i.symbol)
438
+ case TermRef (NoPrefix , name) =>
439
+ if (i.symbol is Flags .Method ) found = This (i.symbol.topLevelClass).select(i.symbol) // workaround #342 todo: remove after fixed
440
+ case _ =>
441
+ }
442
+ if (found != null ) desugared.put(i.tpe, found)
437
443
}
444
+ if (found == null ) None else Some (found)
438
445
}
446
+
439
447
def getLabelDefOwners (tree : Tree ): Map [Tree , List [LabelDef ]] = {
440
448
// for each rhs of a defdef returns LabelDefs inside this DefDef
441
449
val res = new collection.mutable.HashMap [Tree , List [LabelDef ]]()
@@ -892,8 +900,6 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
892
900
def parents : List [Type ] = tp.parents
893
901
}
894
902
895
-
896
-
897
903
object Assign extends AssignDeconstructor {
898
904
def _1 : Tree = field.lhs
899
905
def _2 : Tree = field.rhs
0 commit comments