summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-08-15 12:00:44 +0000
committerMartin Odersky <odersky@gmail.com>2011-08-15 12:00:44 +0000
commit5522aeafa7ac3c5c8cdd6be4fa13afe52b558445 (patch)
treec20019707f702edd7c2aa9ed1eb40bc04300c3a1 /src/compiler
parent3fff0d0caf8a65c7bd8826f23f1a1e12be802ccd (diff)
downloadscala-5522aeafa7ac3c5c8cdd6be4fa13afe52b558445.tar.gz
scala-5522aeafa7ac3c5c8cdd6be4fa13afe52b558445.tar.bz2
scala-5522aeafa7ac3c5c8cdd6be4fa13afe52b558445.zip
Linked Manifests up with Reflection.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/reflect/runtime/Mirror.scala10
-rw-r--r--src/compiler/scala/reflect/runtime/RuntimeTypes.scala31
2 files changed, 34 insertions, 7 deletions
diff --git a/src/compiler/scala/reflect/runtime/Mirror.scala b/src/compiler/scala/reflect/runtime/Mirror.scala
index b1724d6450..d2f043c2e2 100644
--- a/src/compiler/scala/reflect/runtime/Mirror.scala
+++ b/src/compiler/scala/reflect/runtime/Mirror.scala
@@ -6,7 +6,7 @@ import java.lang.reflect.Array
/** The mirror for standard runtime reflection from Java.
*/
-class Mirror extends Universe with api.Mirror {
+class Mirror extends Universe with RuntimeTypes with api.Mirror {
import definitions._
@@ -33,12 +33,8 @@ class Mirror extends Universe with api.Mirror {
methodToJava(meth).invoke(receiver, args.asInstanceOf[Seq[AnyRef]]: _*)
}
- def freeValue(x: Any): Tree = FreeValue(x)
-
- // to do: replace with generalized
- // case class Literal(x: Any),
- // once calls to the deprecated factory Literal(x: Any) has been eliminated from all code.
- case class FreeValue(any: Any) extends Tree
+ override def classToType(jclazz: java.lang.Class[_]): Type = typeToScala(jclazz)
+ override def classToSymbol(jclazz: java.lang.Class[_]): Symbol = classToScala(jclazz)
}
diff --git a/src/compiler/scala/reflect/runtime/RuntimeTypes.scala b/src/compiler/scala/reflect/runtime/RuntimeTypes.scala
new file mode 100644
index 0000000000..818596d7b3
--- /dev/null
+++ b/src/compiler/scala/reflect/runtime/RuntimeTypes.scala
@@ -0,0 +1,31 @@
+package scala.reflect
+package runtime
+
+import collection.mutable.ListBuffer
+
+trait RuntimeTypes extends Universe with api.RuntimeTypes {
+
+ def freeValue(x: Any): Tree = FreeValue(x)
+
+ // to do: replace with generalized
+ // case class Literal(x: Any),
+ // once calls to the deprecated factory Literal(x: Any) has been eliminated from all code.
+ case class FreeValue(any: Any) extends Tree
+
+ case class InstanceRefSymbol(value: AnyRef) extends TermSymbol(NoSymbol, NoPosition, nme.EMPTY)
+ object InstanceRefSymbol extends InstanceRefSymbolExtractor
+
+ override private[reflect] def namedType(pre: Type, sym: Symbol, args: List[Type]): Type = {
+ val tparamBuf = new ListBuffer[Symbol]
+ val args1 = for (arg <- args) yield arg match {
+ case _: TypeBounds =>
+ val ex = pre.typeSymbol.freshExistential("$ex") setInfo arg
+ tparamBuf += ex
+ TypeRef(NoPrefix, ex, List())
+ case _ =>
+ arg
+ }
+ existentialAbstraction(tparamBuf.toList, typeRef(pre, sym, args1))
+ }
+
+} \ No newline at end of file