summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Macros.scala
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2014-05-07 22:50:30 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2014-05-07 22:50:30 +0200
commitf52d31f1ffd90506934ab31aff3c50b9d24d6ec6 (patch)
tree7b7b3a04ac38f1185fb4b42582a1a21d18c6476c /src/compiler/scala/tools/nsc/typechecker/Macros.scala
parentcc58870344e9eea88b8eb18b99176f6db04c7724 (diff)
downloadscala-f52d31f1ffd90506934ab31aff3c50b9d24d6ec6.tar.gz
scala-f52d31f1ffd90506934ab31aff3c50b9d24d6ec6.tar.bz2
scala-f52d31f1ffd90506934ab31aff3c50b9d24d6ec6.zip
Refactor FastTrack to use composition instead of inheritance.
Instead of mixing in FastTrack into Macros trait just have a member with an instance of FastTrack. The motivation for this change is to reduce the overall use of inheritance is Scala compiler and FastTrack seems like a nice target for first step. It's an implementation detail of Scala compiler that we are free to modify. Previously, `fastTrack` method would be inherited from FastTrack trait and called from clients (sub classes). The `fastTrack` method returned Map. Now, the `fastTrack` viariable is of type `FastTrack`. In order for clients to continue to work we had to implement three operations called by clients: contains, apply, get. Alternatively, we could keep the `fastTrack` method and import it in clients. This approach is likely to be more common in the future when bigger pieces of code get refactored.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Macros.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Macros.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Macros.scala b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
index 9cf92ca5b9..f4456998c0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Macros.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Macros.scala
@@ -42,7 +42,7 @@ import Fingerprint._
* (Expr(elems))
* (TypeTag(Int))
*/
-trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
+trait Macros extends MacroRuntimes with Traces with Helpers {
self: Analyzer =>
import global._
@@ -50,6 +50,8 @@ trait Macros extends FastTrack with MacroRuntimes with Traces with Helpers {
import treeInfo.{isRepeatedParamType => _, _}
import MacrosStats._
+ lazy val fastTrack = new FastTrack[self.type](self)
+
def globalSettings = global.settings
protected def findMacroClassLoader(): ClassLoader = {