summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-08-19 16:27:24 +0000
committerMartin Odersky <odersky@gmail.com>2011-08-19 16:27:24 +0000
commit64a2e3074ee5b2cc67776227451ad120746eb156 (patch)
treec2e9f253d7158bd8d15b1ec737f2b56019471f5d
parentbfb20c64a95c62af9c9e1b2bf8a38b97ea606c8f (diff)
downloadscala-64a2e3074ee5b2cc67776227451ad120746eb156.tar.gz
scala-64a2e3074ee5b2cc67776227451ad120746eb156.tar.bz2
scala-64a2e3074ee5b2cc67776227451ad120746eb156.zip
Literals now take Any as argument (used to repr...
Literals now take Any as argument (used to represent free values in reified trees).
-rw-r--r--src/compiler/scala/reflect/runtime/Mirror.scala8
-rw-r--r--src/library/scala/reflect/api/Mirror.scala14
-rw-r--r--src/library/scala/reflect/api/Trees.scala4
3 files changed, 24 insertions, 2 deletions
diff --git a/src/compiler/scala/reflect/runtime/Mirror.scala b/src/compiler/scala/reflect/runtime/Mirror.scala
index d2f043c2e2..fe6b9caa2e 100644
--- a/src/compiler/scala/reflect/runtime/Mirror.scala
+++ b/src/compiler/scala/reflect/runtime/Mirror.scala
@@ -36,6 +36,14 @@ class Mirror extends Universe with RuntimeTypes with api.Mirror {
override def classToType(jclazz: java.lang.Class[_]): Type = typeToScala(jclazz)
override def classToSymbol(jclazz: java.lang.Class[_]): Symbol = classToScala(jclazz)
+ def staticClass(name: String): Symbol = definitions.getClass(newTypeName(name))
+ def staticModule(name: String): Symbol = definitions.getModule(newTermName(name))
+
+ def selectType(owner: Symbol, name: String): Symbol =
+ owner.info.decl(newTypeName(name))
+
+ def selectTerm(owner: Symbol, name: String, tpe: Type): Symbol =
+ owner.info.decl(newTermName(name)) suchThat (_.tpe == tpe)
}
object Mirror extends Mirror
diff --git a/src/library/scala/reflect/api/Mirror.scala b/src/library/scala/reflect/api/Mirror.scala
index 94b6eeeb43..9dc861464a 100644
--- a/src/library/scala/reflect/api/Mirror.scala
+++ b/src/library/scala/reflect/api/Mirror.scala
@@ -64,4 +64,18 @@ trait Mirror extends Universe with RuntimeTypes {
* @return A symbol that represents the Scala view of the class.
*/
def classToSymbol(clazz: java.lang.Class[_]): Symbol
+
+/*
+ /** Selects term symbol with given name and type from the defined members of prefix type
+ * @pre The prefix type
+ * @name The name of the selected member
+ * @tpe The type of the selected member
+ */
+ def selectTerm(pre: Type, name: String, tpe: Type) : Symbol
+
+ /** Selects type symbol with given name from the defined members of prefix type
+ */
+ def selectType(pre: Type, name: String): Symbol
+
+*/
}
diff --git a/src/library/scala/reflect/api/Trees.scala b/src/library/scala/reflect/api/Trees.scala
index 16137379a8..cf9d301e95 100644
--- a/src/library/scala/reflect/api/Trees.scala
+++ b/src/library/scala/reflect/api/Trees.scala
@@ -540,8 +540,8 @@ trait Trees /*extends reflect.generic.Trees*/ { self: Universe =>
assert(value ne null)
}
- @deprecated("will be removed and then be re-introduced with changed semantics, use Literal(Constant(x)) instead")
- def Literal(x: Any) = new Literal(Constant(x))
+// @deprecated("will be removed and then be re-introduced with changed semantics, use Literal(Constant(x)) instead")
+// def Literal(x: Any) = new Literal(Constant(x))
/** A tree that has an annotation attached to it. Only used for annotated types and
* annotation ascriptions, annotations on definitions are stored in the Modifiers.