diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-12-07 16:55:38 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-12-30 19:07:05 +0300 |
commit | 4d92aec651def608628a2275e1b6bf2d1fcbabe7 (patch) | |
tree | d1d51ad3d92343c4345b0b454835a4053234508d /test/files/run/macroPlugins-macroRuntime/Plugin_1.scala | |
parent | 6c7b003003e6cb6a1f0b00f79f784e6deea37a39 (diff) | |
download | scala-4d92aec651def608628a2275e1b6bf2d1fcbabe7.tar.gz scala-4d92aec651def608628a2275e1b6bf2d1fcbabe7.tar.bz2 scala-4d92aec651def608628a2275e1b6bf2d1fcbabe7.zip |
unprivates important helpers in Namers.scala
This is the first of two commits that enable hooks necessary to implement
macro annotations in an honest, hackless compiler plugin.
This particular commit turns certain helpers into public methods. Of course,
there is a probability that with the evolution of macro paradise, I will need
more helper methods, and those will have to be called via reflection, but
at least for now it's nice to have a reflection-less plugin :)
Diffstat (limited to 'test/files/run/macroPlugins-macroRuntime/Plugin_1.scala')
-rw-r--r-- | test/files/run/macroPlugins-macroRuntime/Plugin_1.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/files/run/macroPlugins-macroRuntime/Plugin_1.scala b/test/files/run/macroPlugins-macroRuntime/Plugin_1.scala new file mode 100644 index 0000000000..a55adadb48 --- /dev/null +++ b/test/files/run/macroPlugins-macroRuntime/Plugin_1.scala @@ -0,0 +1,20 @@ +package macroRuntime + +import scala.tools.nsc.Global +import scala.tools.nsc.plugins.{Plugin => NscPlugin} + +class Plugin(val global: Global) extends NscPlugin { + import global._ + import analyzer._ + + val name = "macroRuntime" + val description = "A sample analyzer plugin that overrides macroRuntime." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsMacroRuntime(expandee: Tree): Option[MacroRuntime] = Some({ + case MacroArgs(_, List(msg)) => q"""println("hijacked")""" + }) + } +}
\ No newline at end of file |