From 4d92aec651def608628a2275e1b6bf2d1fcbabe7 Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Sat, 7 Dec 2013 16:55:38 +0100 Subject: 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 :) --- .../run/macroPlugins-macroRuntime/Plugin_1.scala | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 test/files/run/macroPlugins-macroRuntime/Plugin_1.scala (limited to 'test/files/run/macroPlugins-macroRuntime/Plugin_1.scala') 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 -- cgit v1.2.3