diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-26 08:48:26 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-27 15:49:03 +0200 |
commit | e9fbb661a3deb6e6234bdf94dce6fa98a205f3ca (patch) | |
tree | fba72faa84d814735024081a1cd1644e9c75e9da /src/reflect | |
parent | 1839c1b5528e706c280e7d81031499f3d46826ec (diff) | |
download | scala-e9fbb661a3deb6e6234bdf94dce6fa98a205f3ca.tar.gz scala-e9fbb661a3deb6e6234bdf94dce6fa98a205f3ca.tar.bz2 scala-e9fbb661a3deb6e6234bdf94dce6fa98a205f3ca.zip |
removes extraneous stuff from macros.Infrastructure
libraryClassLoader can be derived from currentClassPath
currentMacro can be trivially derived from macroApplication
Backend-detection methods forXXX (as in forJVM or forScaladoc)
might be useful, but current design of this API is not future-proof.
I'm not able to come up with a better design on the spot, so
let's remove this functionality for the moment.
Diffstat (limited to 'src/reflect')
-rw-r--r-- | src/reflect/scala/reflect/macros/Infrastructure.scala | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/src/reflect/scala/reflect/macros/Infrastructure.scala b/src/reflect/scala/reflect/macros/Infrastructure.scala index 80153ff257..f918770a3a 100644 --- a/src/reflect/scala/reflect/macros/Infrastructure.scala +++ b/src/reflect/scala/reflect/macros/Infrastructure.scala @@ -4,50 +4,13 @@ package macros trait Infrastructure { self: Context => - /** Determines whether the compiler expanding a macro targets JVM. - */ - val forJVM: Boolean - - /** Determines whether the compiler expanding a macro targets CLR. - */ - val forMSIL: Boolean - - /** Determines whether the compiler expanding a macro is a presentation compiler. - */ - val forInteractive: Boolean - - /** Determines whether the compiler expanding a macro is a Scaladoc compiler. - */ - val forScaladoc: Boolean - /** Exposes current compilation run. */ val currentRun: Run - /** Exposes library classpath. - */ - val libraryClassPath: List[java.net.URL] - - /** Exposes a classloader that corresponds to the library classpath. - * - * With this classloader you can perform on-the-fly evaluation of macro arguments. - * For example, consider this code snippet: - * - * def staticEval[T](x: T) = macro staticEval[T] - * - * def staticEval[T](c: Context)(x: c.Expr[T]) = { - * import scala.reflect.runtime.{universe => ru} - * val mirror = ru.runtimeMirror(c.libraryClassLoader) - * import scala.tools.reflect.ToolBox - * val toolBox = mirror.mkToolBox() - * val importer = ru.mkImporter(c.universe).asInstanceOf[ru.Importer { val from: c.universe.type }] - * val tree = c.resetAllAttrs(x.tree.duplicate) - * val imported = importer.importTree(tree) - * val valueOfX = toolBox.eval(imported).asInstanceOf[T] - * ... - * } + /** Exposes current classpath. */ - def libraryClassLoader: ClassLoader + val currentClassPath: List[java.net.URL] /** As seen by macro API, compilation run is an opaque type that can be deconstructed into: * 1) Current compilation unit @@ -73,8 +36,4 @@ trait Infrastructure { abstract class CompilationUnitExtractor { def unapply(compilationUnit: CompilationUnit): Option[(java.io.File, Array[Char], Tree)] } - - /** Returns a macro definition which triggered this macro expansion. - */ - val currentMacro: Symbol } |