diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-10-30 14:02:18 +0100 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-01-31 21:44:26 +0100 |
commit | 36a10f0da6c5394e4a74e181211edbe2ec5afa17 (patch) | |
tree | 4e3bfc08b7a958a3ec9aaa162dc3ef6dc0a7846c | |
parent | de4c59e7fe921cd5d1534337fa6f50e7a3f7e8d3 (diff) | |
download | scala-36a10f0da6c5394e4a74e181211edbe2ec5afa17.tar.gz scala-36a10f0da6c5394e4a74e181211edbe2ec5afa17.tar.bz2 scala-36a10f0da6c5394e4a74e181211edbe2ec5afa17.zip |
Optimize TreeInfo#isMacroApplication.
It's called rather frequently. Tree#symbol is a megamorphic call,
which featured in profiles.
-rw-r--r-- | src/reflect/scala/reflect/internal/TreeInfo.scala | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/TreeInfo.scala b/src/reflect/scala/reflect/internal/TreeInfo.scala index 0481719b7b..7bab15b0f4 100644 --- a/src/reflect/scala/reflect/internal/TreeInfo.scala +++ b/src/reflect/scala/reflect/internal/TreeInfo.scala @@ -848,8 +848,10 @@ abstract class TreeInfo { case _ => false }) - def isMacroApplication(tree: Tree): Boolean = - !tree.isDef && tree.symbol != null && tree.symbol.isTermMacro && !tree.symbol.isErroneous + def isMacroApplication(tree: Tree): Boolean = !tree.isDef && { + val sym = tree.symbol + sym != null && sym.isTermMacro && !sym.isErroneous + } def isMacroApplicationOrBlock(tree: Tree): Boolean = tree match { case Block(_, expr) => isMacroApplicationOrBlock(expr) |