diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-10 03:41:49 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-10 17:20:41 +0100 |
commit | 5d38be773a2083fa2112f5cb688070b867634120 (patch) | |
tree | 63eebc91accacb51faade6cf4ece4f271911a13d /src/dotty/tools/dotc/core/Denotations.scala | |
parent | a63c3db753e8dcc0ed9daa3834ac7a01d6748540 (diff) | |
download | dotty-5d38be773a2083fa2112f5cb688070b867634120.tar.gz dotty-5d38be773a2083fa2112f5cb688070b867634120.tar.bz2 dotty-5d38be773a2083fa2112f5cb688070b867634120.zip |
Mover termRef/typeRef and friends up to Denotation.
Needed for implicit search, because some implicits might be UniqueRefs, not SymDenotations
Diffstat (limited to 'src/dotty/tools/dotc/core/Denotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index f2df71627..e6d5023e5 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -392,6 +392,36 @@ object Denotations { def atSignature(sig: Signature)(implicit ctx: Context): SingleDenotation = if (sig matches signature) this else NoDenotation + // ------ Forming types ------------------------------------------- + + /** The TypeRef representing this type denotation at its original location. */ + def typeRef(implicit ctx: Context): TypeRef = + TypeRef(symbol.owner.thisType, symbol.name.asTypeName, this) + + /** The TermRef representing this term denotation at its original location. */ + def termRef(implicit ctx: Context): TermRef = + TermRef(symbol.owner.thisType, symbol.name.asTermName, this) + + /** The TermRef representing this term denotation at its original location + * and at signature `NotAMethod`. + */ + def valRef(implicit ctx: Context): TermRef = + TermRef.withSig(symbol.owner.thisType, symbol.name.asTermName, Signature.NotAMethod, this) + + /** The TermRef representing this term denotation at its original location + * at the denotation's signature. + * @note Unlike `valRef` and `termRef`, this will force the completion of the + * denotation via a call to `info`. + */ + def termRefWithSig(implicit ctx: Context): TermRef = + TermRef.withSig(symbol.owner.thisType, symbol.name.asTermName, signature, this) + + /** The NamedType representing this denotation at its original location. + * Same as either `typeRef` or `termRefWithSig` depending whether this denotes a type or not. + */ + def namedType(implicit ctx: Context): NamedType = + if (isType) typeRef else termRefWithSig + // ------ Transformations ----------------------------------------- private[this] var myValidFor: Period = Nowhere |