diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2012-07-21 15:02:40 +0200 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2012-07-23 17:02:03 +0200 |
commit | f2819ff3796427378c4688e13bc0f4a20b550df9 (patch) | |
tree | e458ca024c35f147bddb24bd6559da1a1de269a5 /src/library | |
parent | 40ddd083592ba3947cb5182d6db26798bad9a9cb (diff) | |
download | scala-f2819ff3796427378c4688e13bc0f4a20b550df9.tar.gz scala-f2819ff3796427378c4688e13bc0f4a20b550df9.tar.bz2 scala-f2819ff3796427378c4688e13bc0f4a20b550df9.zip |
Small changes to reflection API to make it safe for IDE use.
* Removed `typeSymbol` and `termSymbol` from `reflect.api.base`, and pushed them down to
`reflect.api`.
* extracted `TypeTree.symbol` to a top-level method so it can be overridden in other layers
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/reflect/base/Base.scala | 2 | ||||
-rw-r--r-- | src/library/scala/reflect/base/Types.scala | 17 |
2 files changed, 4 insertions, 15 deletions
diff --git a/src/library/scala/reflect/base/Base.scala b/src/library/scala/reflect/base/Base.scala index 4457a6cf14..5df48307fe 100644 --- a/src/library/scala/reflect/base/Base.scala +++ b/src/library/scala/reflect/base/Base.scala @@ -96,8 +96,8 @@ class Base extends Universe { self => // todo. write a decent toString that doesn't crash on recursive types class Type extends TypeBase { - def typeSymbol: Symbol = NoSymbol def termSymbol: Symbol = NoSymbol + def typeSymbol: Symbol = NoSymbol } implicit val TypeTagg = ClassTag[Type](classOf[Type]) diff --git a/src/library/scala/reflect/base/Types.scala b/src/library/scala/reflect/base/Types.scala index 6e8ffc7984..28aaf2d04d 100644 --- a/src/library/scala/reflect/base/Types.scala +++ b/src/library/scala/reflect/base/Types.scala @@ -3,25 +3,14 @@ package base trait Types { self: Universe => - /** The base API that all types support */ - abstract class TypeBase { - - /** The term symbol associated with the type, or `NoSymbol` for types - * that do not refer to a term symbol. - */ - def termSymbol: Symbol - - /** The type symbol associated with the type, or `NoSymbol` for types - * that do not refer to a type symbol. - */ - def typeSymbol: Symbol - } - /** The type of Scala types, and also Scala type signatures. * (No difference is internally made between the two). */ type Type >: Null <: TypeBase + /** The base API that all types support */ + abstract class TypeBase + /** A tag that preserves the identity of the `Type` abstract type from erasure. * Can be used for pattern matching, instance tests, serialization and likes. */ |