summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/TreeGen.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/TreeGen.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeGen.scala15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeGen.scala b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
index 7f2bcf99c5..9f2065f297 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeGen.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeGen.scala
@@ -98,7 +98,7 @@ abstract class TreeGen
mkAttributedQualifier(firstStable.get)
case _ =>
- throw new Error("bad qualifier: " + tpe)
+ abort("bad qualifier: " + tpe)
}
/** Builds a reference to given symbol with given stable prefix. */
@@ -192,7 +192,7 @@ abstract class TreeGen
mkTypeApply(value, tpe, (if (any) Any_asInstanceOf else Object_asInstanceOf))
def mkClassOf(tp: Type): Tree =
- Literal(Constant(tp)) setType Predef_classOfType(tp)
+ Literal(Constant(tp)) setType ConstantType(Constant(tp))// ClassType(tp)
def mkCheckInit(tree: Tree): Tree = {
val tpe =
@@ -331,6 +331,17 @@ abstract class TreeGen
Apply(meth, List(tree))
}
+ /** Try to convert Select(qual, name) to a SelectFromTypeTree.
+ */
+ def convertToSelectFromType(qual: Tree, name: Name): Tree = {
+ def selFromType(qual1: Tree) = SelectFromTypeTree(qual1 setPos qual.pos, name)
+ qual match {
+ case Select(qual1, name) => selFromType(Select(qual1, name.toTypeName))
+ case Ident(name) => selFromType(Ident(name.toTypeName))
+ case _ => EmptyTree
+ }
+ }
+
/** Used in situations where you need to access value of an expression several times
*/
def evalOnce(expr: Tree, owner: Symbol, unit: CompilationUnit)(within: (() => Tree) => Tree): Tree = {