aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Denotations.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-02 11:00:34 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-02 11:17:14 +0100
commit24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813 (patch)
treeb52eef18a9e5fbf630fbdeb104bffd66b950ccdf /src/dotty/tools/dotc/core/Denotations.scala
parent49e6eb07bf55cf9eabb260e7b7a8fef45923e8df (diff)
downloaddotty-24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813.tar.gz
dotty-24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813.tar.bz2
dotty-24f5a1ef4b8a49b6a2a8c684c1c98bc6a5293813.zip
Polishing of denotations
1. Dropped owner from denot#asSeenFrom. Code inspection shows that one needs to take the owner of the symbol in each alternative instead. 2. Changed fullName so that terms in the ownerchain leave a trace. Needed for disambiguating private symbols with expanded names. See worksheet nesting.sc for an example. 3. Changed fingerPrint so that only classes with children have their fingerPrints computed. Reason: When we lookup a member of a class initially, it's likely that the member is present, so a bloom filter will not buy us much and will take up memory. For parent classes it's different. We might have found the member already in the child, or in a different parent, so it's more likely that the fingerPrint is effective.
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index 3e6367f2a..ef4fba5b9 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -452,8 +452,8 @@ object Denotations {
if (symbol is flags) NoDenotation else this
def filterAccessibleFrom(pre: Type)(implicit ctx: Context): PreDenotation =
if (symbol.isAccessibleFrom(pre)) this else NoDenotation
- def asSeenFrom(pre: Type, owner: Symbol)(implicit ctx: Context): PreDenotation =
- derivedSingleDenotation(symbol, info.asSeenFrom(pre, owner))
+ def asSeenFrom(pre: Type)(implicit ctx: Context): PreDenotation =
+ derivedSingleDenotation(symbol, info.asSeenFrom(pre, symbol.owner))
}
class UniqueRefDenotation(val symbol: Symbol,
@@ -510,10 +510,10 @@ object Denotations {
*/
def filterAccessibleFrom(pre: Type)(implicit ctx: Context): PreDenotation
- /** The denotations as seen from given prefix type `pre`, where `owner`
- * is assumed to be the owner of all denotation symbols.
+ /** The denotations as seen from given prefix type `pre`.
+ * @pre All denotations need to have an existing symbol.
*/
- def asSeenFrom(pre: Type, owner: Symbol)(implicit ctx: Context): PreDenotation
+ def asSeenFrom(pre: Type)(implicit ctx: Context): PreDenotation
/** The union of two groups. */
def union(that: PreDenotation) =
@@ -537,8 +537,8 @@ object Denotations {
derivedUnion(denots1 filterExcluded flags, denots2 filterExcluded flags)
def filterAccessibleFrom(pre: Type)(implicit ctx: Context): PreDenotation =
derivedUnion(denots1 filterAccessibleFrom pre, denots2 filterAccessibleFrom pre)
- def asSeenFrom(pre: Type, owner: Symbol)(implicit ctx: Context): PreDenotation =
- derivedUnion(denots1.asSeenFrom(pre, owner), denots2.asSeenFrom(pre, owner))
+ def asSeenFrom(pre: Type)(implicit ctx: Context): PreDenotation =
+ derivedUnion(denots1.asSeenFrom(pre), denots2.asSeenFrom(pre))
private def derivedUnion(denots1: PreDenotation, denots2: PreDenotation) =
if ((denots1 eq this.denots1) && (denots2 eq this.denots2)) this
else denots1 union denots2