Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable names for lambda lifted methods #18281

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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