summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-11-05 10:29:10 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-01-31 21:42:08 +0100
commitde4c59e7fe921cd5d1534337fa6f50e7a3f7e8d3 (patch)
tree0dad5d5ba4386ab961a84755d0bbeee6e86f50de
parenta6f2704619a1f724693b456dadcb1836e2f71328 (diff)
downloadscala-de4c59e7fe921cd5d1534337fa6f50e7a3f7e8d3.tar.gz
scala-de4c59e7fe921cd5d1534337fa6f50e7a3f7e8d3.tar.bz2
scala-de4c59e7fe921cd5d1534337fa6f50e7a3f7e8d3.zip
Optimize isSelfSuperCall
Avoid the Applied extractor altogether, as that eagerly creates `argss` which we don't need and which is quite expensive.
-rw-r--r--src/reflect/scala/reflect/internal/TreeInfo.scala14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala
index 497a7c91b1..0481719b7b 100644
--- a/src/reflect/scala/reflect/internal/TreeInfo.scala
+++ b/src/reflect/scala/reflect/internal/TreeInfo.scala
@@ -284,17 +284,17 @@ abstract class TreeInfo {
/** Is tree a self constructor call this(...)? I.e. a call to a constructor of the
* same object?
*/
- def isSelfConstrCall(tree: Tree): Boolean = tree match {
- case Applied(Ident(nme.CONSTRUCTOR), _, _) => true
- case Applied(Select(This(_), nme.CONSTRUCTOR), _, _) => true
- case _ => false
+ def isSelfConstrCall(tree: Tree): Boolean = dissectApplied(tree).core match {
+ case Ident(nme.CONSTRUCTOR) => true
+ case Select(This(_), nme.CONSTRUCTOR) => true
+ case _ => false
}
/** Is tree a super constructor call?
*/
- def isSuperConstrCall(tree: Tree): Boolean = tree match {
- case Applied(Select(Super(_, _), nme.CONSTRUCTOR), _, _) => true
- case _ => false
+ def isSuperConstrCall(tree: Tree): Boolean = dissectApplied(tree).core match {
+ case Select(Super(_, _), nme.CONSTRUCTOR) => true
+ case _ => false
}
/**