summaryrefslogtreecommitdiff
path: root/src/library/scala/reflect/makro/Context.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-06-06 14:29:05 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-06-08 15:31:58 +0200
commitce67870e64afabf75363679bcee597812ad223e9 (patch)
treece84ef7673977b0dde4ed13ca1276e25517d6b9c /src/library/scala/reflect/makro/Context.scala
parentbdff66e2730518f449634375b1f3d19689d72b1e (diff)
downloadscala-ce67870e64afabf75363679bcee597812ad223e9.tar.gz
scala-ce67870e64afabf75363679bcee597812ad223e9.tar.bz2
scala-ce67870e64afabf75363679bcee597812ad223e9.zip
brings macros up to speed
Before reflection refactoring, macro contexts only exposed a mirror. Now it's time to expose both a universe (the compiler instance) and a mirror (a macro-specific symbol resolver). By the way, speaking of mirrors. Macro contexts have their own mirror, which is different from compiler's rootMirror. This is done because macros need to be able to resolve stuff from empty package. Reflection refactoring brought major changes to runtime evaluation, which got dropped from universes and now requires scala-compiler.jar. However there are macro users, who would like to do eval inside macros. To help them we expose `libraryClassLoader` to manually build toolboxes, and also a simple-to-use `c.eval` method. I've also sneakily introduced `c.parse`, because it's something that has also been frequently requested. Moreover, it might help Scaladoc. So I decided that it might be worth it to add this new functionality.
Diffstat (limited to 'src/library/scala/reflect/makro/Context.scala')
-rw-r--r--src/library/scala/reflect/makro/Context.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/library/scala/reflect/makro/Context.scala b/src/library/scala/reflect/makro/Context.scala
index fb77405d37..58fd0d3df3 100644
--- a/src/library/scala/reflect/makro/Context.scala
+++ b/src/library/scala/reflect/makro/Context.scala
@@ -15,12 +15,17 @@ trait Context extends Aliases
with FrontEnds
with Settings
with Typers
+ with Parsers
with Exprs
with TypeTags
+ with Evals
with Util {
- /** The mirror that corresponds to the compile-time universe */
- val mirror: Universe
+ /** The compile-time universe */
+ val universe: Universe
+
+ /** The mirror of the compile-time universe */
+ val mirror: MirrorOf[universe.type]
/** The type of the prefix tree from which the macro is selected */
type PrefixType