summaryrefslogtreecommitdiff
path: root/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2013-01-06 20:17:49 -0800
committerEugene Burmako <xeno.by@gmail.com>2013-01-06 20:17:49 -0800
commita03e77b8670faa133c76f4d7b29bf362246d20b5 (patch)
tree4657735c741511f7703f65614cc3bbb375055435 /test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala
parent2d0fb869fc7b813f562417372120bb25cb636642 (diff)
parent1f1e36922af099d647931a61ebdf5cec97ab54ac (diff)
downloadscala-3dd62ada7c17cf7979b9260c92cb0b8ee5026b94.tar.gz
scala-3dd62ada7c17cf7979b9260c92cb0b8ee5026b94.tar.bz2
scala-3dd62ada7c17cf7979b9260c92cb0b8ee5026b94.zip
Merge pull request #1817 from scalamacros/topic/introduce-top-levelv2.11.0-M1
adds c.introduceTopLevel
Diffstat (limited to 'test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala')
-rw-r--r--test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala b/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala
new file mode 100644
index 0000000000..f30adc2965
--- /dev/null
+++ b/test/files/run/macro-toplevel-companion-b/Impls_Macros_1.scala
@@ -0,0 +1,15 @@
+import scala.reflect.macros.Context
+import language.experimental.macros
+
+object Macros {
+ def impl(c: Context) = {
+ import c.universe._
+ val Block(List(cdef: ClassDef), _) = reify{ class C }.tree
+ val classRef = c.topLevelRef(TypeName("C")) orElse c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, cdef)
+ val Block(List(mdef: ModuleDef), _) = reify{ object C }.tree
+ val moduleRef = c.topLevelRef(TermName("C")) orElse c.introduceTopLevel(nme.EMPTY_PACKAGE_NAME.toString, mdef)
+ c.literalUnit
+ }
+
+ def foo = macro impl
+} \ No newline at end of file