diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2014-01-08 11:17:08 -0800 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2014-01-08 11:17:08 -0800 |
commit | 4e4c15177b92ef25f098277dcce3f874c24640b2 (patch) | |
tree | f46a594ffb47c53cde502d3e172dd4b1c6c2e109 /test/files/run/macroPlugins-macroArgs/Plugin_1.scala | |
parent | ada8d9156baad2d8a24c1a40e032eb4bc7154bac (diff) | |
parent | 87913661e199e3894190b7b8aa0900d7237feec0 (diff) | |
download | scala-4e4c15177b92ef25f098277dcce3f874c24640b2.tar.gz scala-4e4c15177b92ef25f098277dcce3f874c24640b2.tar.bz2 scala-4e4c15177b92ef25f098277dcce3f874c24640b2.zip |
Merge pull request #3235 from xeno-by/topic/macro-plugin-interface
new hooks in AnalyzerPlugins to enable macro experimentation
Diffstat (limited to 'test/files/run/macroPlugins-macroArgs/Plugin_1.scala')
-rw-r--r-- | test/files/run/macroPlugins-macroArgs/Plugin_1.scala | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/macroPlugins-macroArgs/Plugin_1.scala b/test/files/run/macroPlugins-macroArgs/Plugin_1.scala new file mode 100644 index 0000000000..23e80ced3b --- /dev/null +++ b/test/files/run/macroPlugins-macroArgs/Plugin_1.scala @@ -0,0 +1,21 @@ +package macroArgs + +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 = "macroArgs" + val description = "A sample analyzer plugin that overrides macroArgs." + val components = Nil + addMacroPlugin(MacroPlugin) + + object MacroPlugin extends MacroPlugin { + override def pluginsMacroArgs(typer: Typer, expandee: Tree): Option[MacroArgs] = { + val MacroArgs(c, List(Literal(Constant(s: String)))) = standardMacroArgs(typer, expandee) + Some(MacroArgs(c, List(Literal(Constant("hijacked " + s))))) + } + } +}
\ No newline at end of file |