aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymDenotations.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala
index 7d1948784..b0a09baf0 100644
--- a/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -83,6 +83,9 @@ object SymDenotations {
/** The owner of the symbol; overridden in NoDenotation */
def owner: Symbol = ownerIfExists
+ /** Same as owner, except returns NoSymbol for NoSymbol */
+ def maybeOwner: Symbol = if (exists) owner else NoSymbol
+
/** The flag set */
final def flags(implicit ctx: Context): FlagSet = { ensureCompleted(); myFlags }
@@ -987,6 +990,7 @@ object SymDenotations {
mySuperClassBits = null
myMemberFingerPrint = FingerPrint.unknown
myMemberCache = null
+ myMemberCachePeriod = Nowhere
memberNamesCache = SimpleMap.Empty
}
@@ -1121,9 +1125,13 @@ object SymDenotations {
}
private[this] var myMemberCache: LRUCache[Name, PreDenotation] = null
+ private[this] var myMemberCachePeriod: Period = Nowhere
- private def memberCache: LRUCache[Name, PreDenotation] = {
- if (myMemberCache == null) myMemberCache = new LRUCache
+ private def memberCache(implicit ctx: Context): LRUCache[Name, PreDenotation] = {
+ if (myMemberCachePeriod != ctx.period) {
+ myMemberCache = new LRUCache
+ myMemberCachePeriod = ctx.period
+ }
myMemberCache
}