summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Gruntz <dominik.gruntz@fhnw.ch>2012-08-29 23:09:10 +0200
committerDominik Gruntz <dominik.gruntz@fhnw.ch>2012-08-30 01:02:40 +0200
commitc1e45256edda3d059675e13e77fe3af46f88bc7d (patch)
treeaf53c05f981d0b8ed2aead2e443d2d3942058728
parente03a5b766be27a1f43c9151a611b04519a2b15df (diff)
downloadscala-c1e45256edda3d059675e13e77fe3af46f88bc7d.tar.gz
scala-c1e45256edda3d059675e13e77fe3af46f88bc7d.tar.bz2
scala-c1e45256edda3d059675e13e77fe3af46f88bc7d.zip
Reflection tuning
This pull request applies some tuning changes to the reflection library: 1) the traits scala.reflect.api.FlagSets, scala.reflect.api.Mirrors and scala.reflect.internal.Importers extend their corresponding trait in the base layer of the cake. 2) method isType and asType in trait TypeSymbolBase is declared final 3) small changes in the docs.
-rw-r--r--src/library/scala/reflect/base/Symbols.scala16
-rw-r--r--src/reflect/scala/reflect/api/FlagSets.scala2
-rw-r--r--src/reflect/scala/reflect/api/Mirrors.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Importers.scala2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/library/scala/reflect/base/Symbols.scala b/src/library/scala/reflect/base/Symbols.scala
index 294fa19d62..3830264425 100644
--- a/src/library/scala/reflect/base/Symbols.scala
+++ b/src/library/scala/reflect/base/Symbols.scala
@@ -107,8 +107,8 @@ trait Symbols { self: Universe =>
/** Does this symbol represent the definition of a type?
* Note that every symbol is either a term or a type.
- * So for every symbol `sym`, either `sym.isTerm` is true
- * or `sym.isType` is true.
+ * So for every symbol `sym` (except for `NoSymbol`),
+ * either `sym.isTerm` is true or `sym.isType` is true.
*/
def isType: Boolean = false
@@ -118,9 +118,9 @@ trait Symbols { self: Universe =>
def asType: TypeSymbol = throw new ScalaReflectionException(s"$this is not a type")
/** Does this symbol represent the definition of a term?
- * Note that every symbol is either a term or a term.
- * So for every symbol `sym`, either `sym.isTerm` is true
- * or `sym.isTerm` is true.
+ * Note that every symbol is either a term or a type.
+ * So for every symbol `sym` (except for `NoSymbol`),
+ * either `sym.isTerm` is true or `sym.isTerm` is true.
*/
def isTerm: Boolean = false
@@ -234,10 +234,10 @@ trait Symbols { self: Universe =>
* `PolyType(ClassInfoType(...))` that describes type parameters, value
* parameters, parent types, and members of `C`.
*/
- def toType: Type
+ def toType: Type
- override def isType = true
- override def asType = this
+ final override def isType = true
+ final override def asType = this
}
/** The base API that all term symbols support */
diff --git a/src/reflect/scala/reflect/api/FlagSets.scala b/src/reflect/scala/reflect/api/FlagSets.scala
index 36836e84a9..fdd43f1883 100644
--- a/src/reflect/scala/reflect/api/FlagSets.scala
+++ b/src/reflect/scala/reflect/api/FlagSets.scala
@@ -3,7 +3,7 @@ package api
import scala.language.implicitConversions
-trait FlagSets { self: Universe =>
+trait FlagSets extends base.FlagSets { self: Universe =>
type FlagSet
diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala
index 7d185d9879..8c4c423221 100644
--- a/src/reflect/scala/reflect/api/Mirrors.scala
+++ b/src/reflect/scala/reflect/api/Mirrors.scala
@@ -1,7 +1,7 @@
package scala.reflect
package api
-trait Mirrors { self: Universe =>
+trait Mirrors extends base.Mirrors { self: Universe =>
type RuntimeClass >: Null
diff --git a/src/reflect/scala/reflect/internal/Importers.scala b/src/reflect/scala/reflect/internal/Importers.scala
index d5baad8ab1..4b3eb0cdc4 100644
--- a/src/reflect/scala/reflect/internal/Importers.scala
+++ b/src/reflect/scala/reflect/internal/Importers.scala
@@ -3,7 +3,7 @@ package internal
import scala.collection.mutable.WeakHashMap
// SI-6241: move importers to a mirror
-trait Importers { self: SymbolTable =>
+trait Importers extends api.Importers { self: SymbolTable =>
def mkImporter(from0: api.Universe): Importer { val from: from0.type } = (
if (self eq from0) {