summaryrefslogtreecommitdiff
path: root/src/compiler/scala/reflect/internal/TreeGen.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-07-30 00:41:40 +0000
committerMartin Odersky <odersky@gmail.com>2011-07-30 00:41:40 +0000
commit613f30f1cd0170012fedf6608140a585f544db58 (patch)
tree0ea4099f0442040d07b4b1b02dcc5c94d86b1966 /src/compiler/scala/reflect/internal/TreeGen.scala
parent67a63278a6c4e9347792219086f11a87d177eee7 (diff)
downloadscala-613f30f1cd0170012fedf6608140a585f544db58.tar.gz
scala-613f30f1cd0170012fedf6608140a585f544db58.tar.bz2
scala-613f30f1cd0170012fedf6608140a585f544db58.zip
Getting LiftCode to work.
Diffstat (limited to 'src/compiler/scala/reflect/internal/TreeGen.scala')
-rw-r--r--src/compiler/scala/reflect/internal/TreeGen.scala21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/compiler/scala/reflect/internal/TreeGen.scala b/src/compiler/scala/reflect/internal/TreeGen.scala
index a5149898b2..15c339aefd 100644
--- a/src/compiler/scala/reflect/internal/TreeGen.scala
+++ b/src/compiler/scala/reflect/internal/TreeGen.scala
@@ -189,21 +189,18 @@ abstract class TreeGen {
}
}
- private def mkTypeApply(value: Tree, tpe: Type, what: Symbol) =
- Apply(
- TypeApply(
- mkAttributedSelect(value, what),
- List(TypeTree(tpe.normalize))
- ),
- Nil
- )
+ private def mkTypeApply(value: Tree, tpe: Type, what: Symbol, wrapInApply: Boolean) = {
+ val tapp = TypeApply(mkAttributedSelect(value, what), List(TypeTree(tpe.normalize)))
+ if (wrapInApply) Apply(tapp, List()) else tapp
+ }
+
/** Builds an instance test with given value and type. */
- def mkIsInstanceOf(value: Tree, tpe: Type, any: Boolean = true): Tree =
- mkTypeApply(value, tpe, (if (any) Any_isInstanceOf else Object_isInstanceOf))
+ def mkIsInstanceOf(value: Tree, tpe: Type, any: Boolean = true, wrapInApply: Boolean = true): Tree =
+ mkTypeApply(value, tpe, (if (any) Any_isInstanceOf else Object_isInstanceOf), wrapInApply)
/** Builds a cast with given value and type. */
- def mkAsInstanceOf(value: Tree, tpe: Type, any: Boolean = true): Tree =
- mkTypeApply(value, tpe, (if (any) Any_asInstanceOf else Object_asInstanceOf))
+ def mkAsInstanceOf(value: Tree, tpe: Type, any: Boolean = true, wrapInApply: Boolean = true): Tree =
+ mkTypeApply(value, tpe, (if (any) Any_asInstanceOf else Object_asInstanceOf), wrapInApply)
/** Cast `tree` to `pt`, unless tpe is a subtype of pt, or pt is Unit. */
def maybeMkAsInstanceOf(tree: Tree, pt: Type, tpe: Type, beforeRefChecks: Boolean = false): Tree =