summaryrefslogtreecommitdiff
path: root/test/files/run/macro-duplicate
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-12-25 02:37:31 +0100
committerEugene Burmako <xeno.by@gmail.com>2013-01-05 01:39:15 +0300
commit348c8fac9f897f9661f84e32949b8a4e0c99e93a (patch)
tree810b2d7d53451ceba5e43e1687a86cdedffd39f1 /test/files/run/macro-duplicate
parented4f4798df2ac104d9557de2241d8e89283b0662 (diff)
downloadscala-348c8fac9f897f9661f84e32949b8a4e0c99e93a.tar.gz
scala-348c8fac9f897f9661f84e32949b8a4e0c99e93a.tar.bz2
scala-348c8fac9f897f9661f84e32949b8a4e0c99e93a.zip
adds c.introduceTopLevel
The first in the family of mutators for the global symbol table, `introduceTopLevel` is capable of creating synthetic top-level classes and modules. The addition of nme.EMPTY_PACKAGE_NAME is necessary to let programmers insert definitions into the empty package. That's explicitly discouraged in the docs, but at times might come in handy. This patch introduce workarounds to avoid incompatibilities with SBT. First of all SBT doesn't like VirtualFiles having JFile set to null. Secondly SBT gets confused when someone depends on synthetic files added by c.introduceTopLevel. Strictly speaking these problems require changes to SBT, and that will be done later. However the main target of the patch is paradise/macros, which needs to be useful immediately, therefore we apply workarounds.
Diffstat (limited to 'test/files/run/macro-duplicate')
-rw-r--r--test/files/run/macro-duplicate/Impls_Macros_1.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/files/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala
index de81923330..af80147a90 100644
--- a/test/files/run/macro-duplicate/Impls_Macros_1.scala
+++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala
@@ -10,11 +10,11 @@ object Macros {
case Template(_, _, ctor :: defs) =>
val defs1 = defs collect {
case ddef @ DefDef(mods, name, tparams, vparamss, tpt, body) =>
- val future = Select(Select(Select(Ident(newTermName("scala")), newTermName("concurrent")), newTermName("package")), newTermName("future"))
- val Future = Select(Select(Ident(newTermName("scala")), newTermName("concurrent")), newTypeName("Future"))
+ val future = Select(Select(Select(Ident(TermName("scala")), TermName("concurrent")), TermName("package")), TermName("future"))
+ val Future = Select(Select(Ident(TermName("scala")), TermName("concurrent")), TypeName("Future"))
val tpt1 = if (tpt.isEmpty) tpt else AppliedTypeTree(Future, List(tpt))
val body1 = Apply(future, List(body))
- val name1 = newTermName("async" + name.toString.capitalize)
+ val name1 = TermName("async" + name.toString.capitalize)
DefDef(mods, name1, tparams, vparamss, tpt1, body1)
}
Template(Nil, emptyValDef, ctor +: defs ::: defs1)