Skip to content

Commit d27fff7

Browse files
committed
Streamline sortedProxies
1 parent e1361cf commit d27fff7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

compiler/src/dotty/tools/dotc/typer/Inliner.scala

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,14 +508,9 @@ class Inliner(call: tpd.Tree, rhsToInline: tpd.Tree)(using Context) {
508508
private def computeThisBindings() = {
509509
// All needed this-proxies, paired-with and sorted-by nesting depth of
510510
// the classes they represent (innermost first)
511-
val sortedProxies = thisProxy.toList.map {
512-
case (cls, proxy) =>
513-
// The class that the this-proxy `selfSym` represents
514-
def classOf(selfSym: Symbol) = selfSym.info.classSymbol
515-
// The total nesting depth of the class represented by `selfSym`.
516-
def outerLevel(selfSym: Symbol): Int = classOf(selfSym).ownersIterator.length
517-
(outerLevel(cls), proxy.symbol)
518-
}.sortBy(-_._1)
511+
val sortedProxies = thisProxy.toList
512+
.map((cls, proxy) => (cls.ownersIterator.length, proxy.symbol))
513+
.sortBy(-_._1)
519514

520515
var lastSelf: Symbol = NoSymbol
521516
var lastLevel: Int = 0

0 commit comments

Comments
 (0)