diff options
Diffstat (limited to 'docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala')
-rw-r--r-- | docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala new file mode 100644 index 0000000000..b6e405dcef --- /dev/null +++ b/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala @@ -0,0 +1,33 @@ +package plugintemplate + +import scala.tools.nsc._ +import scala.tools.nsc.plugins.PluginComponent + +/** This class shows how to implement a compiler component that + * can be used in a compiler plugin. + * + * @todo Adapt the name of this class to the plugin, and implement it. + */ +class TemplateComponent(val global: Global) extends PluginComponent { + import global._ + import global.definitions._ + + val runsAfter = "refchecks" + /** The phase name of the compiler plugin + * @todo Adapt to specific plugin. + */ + val phaseName = "plugintemplate" + + def newPhase(prev: Phase) = new Phase(prev) { + def name = phaseName + + /** This method contains the implementation of the compiler + * component + * + * @todo Implementation. + */ + def run { + println("Hello from phase "+ name) + } + } +} |