summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/Global.scala
diff options
context:
space:
mode:
authorDen Shabalin <den.shabalin@gmail.com>2013-10-10 12:56:37 +0200
committerDen Shabalin <den.shabalin@gmail.com>2013-10-18 17:24:52 +0200
commit27fca0fc3fecef10ece59a4c28282301ce2cd961 (patch)
tree5a04db11fe99797764430e0f816011bbf187289c /src/compiler/scala/tools/nsc/Global.scala
parent3692acaa40c8edcf4a5e7f4fcfa29ef090385df2 (diff)
downloadscala-27fca0fc3fecef10ece59a4c28282301ce2cd961.tar.gz
scala-27fca0fc3fecef10ece59a4c28282301ce2cd961.tar.bz2
scala-27fca0fc3fecef10ece59a4c28282301ce2cd961.zip
decrease duplication of fresh* function definitions
This commit extracts out freshTermName and freshTypeName to the top-level with implicit fresh name creator argument. This will let to refactor out more methods out of tree builder into treegen that are dependent on fresh name generator. We also save quite a bit of boilerplate by not having to redefined fresh functions all over the place.
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 1cd3e0ec4b..46456093eb 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -110,9 +110,10 @@ class Global(var currentSettings: Settings, var reporter: Reporter)
}
/** A spare instance of TreeBuilder left for backwards compatibility. */
- lazy val treeBuilder: TreeBuilder { val global: Global.this.type } = new UnitTreeBuilder {
+ lazy val treeBuilder: TreeBuilder { val global: Global.this.type } = new TreeBuilder {
val global: Global.this.type = Global.this;
- val unit = currentUnit
+ def unit = currentUnit
+ def source = currentUnit.source
}
/** Fold constants */