Skip to content

Commit

Permalink
Backport "Stable names for lambda lifted methods" to LTS (#19130)
Browse files Browse the repository at this point in the history
Backports #18281 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
  • Loading branch information
Kordyjan authored Dec 8, 2023
2 parents 83a668c + cb8fd0e commit 1e7141a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions compiler/src/dotty/tools/dotc/transform/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package transform
import core.*
import Symbols.*, Contexts.*, Types.*, Flags.*, Decorators.*
import SymUtils.*
import collection.mutable.{LinkedHashMap, TreeSet}
import collection.mutable.{LinkedHashMap, LinkedHashSet}
import annotation.constructorOnly

import dotty.tools.backend.sjs.JSDefinitions.jsdefn
Expand Down Expand Up @@ -33,7 +33,7 @@ abstract class Dependencies(root: ast.tpd.Tree, @constructorOnly rootContext: Co
*/
def logicalOwner: collection.Map[Symbol, Symbol] = logicOwner

private type SymSet = TreeSet[Symbol]
private type SymSet = LinkedHashSet[Symbol]

/** A map storing free variables of functions and classes */
private val free: LinkedHashMap[Symbol, SymSet] = new LinkedHashMap
Expand All @@ -56,8 +56,7 @@ abstract class Dependencies(root: ast.tpd.Tree, @constructorOnly rootContext: Co
/** A flag to indicate whether lifted owners have changed */
private var changedLogicOwner: Boolean = _

private val ord: Ordering[Symbol] = Ordering.by(_.id)
private def newSymSet = TreeSet.empty[Symbol](ord)
private def newSymSet: LinkedHashSet[Symbol] = new LinkedHashSet[Symbol]

private def symSet(f: LinkedHashMap[Symbol, SymSet], sym: Symbol): SymSet =
f.getOrElseUpdate(sym, newSymSet)
Expand Down

0 comments on commit 1e7141a

Please sign in to comment.