From b85f33beb78cfbf480acee353f5b5ed83980b3fc Mon Sep 17 00:00:00 2001 From: nielsen Date: Thu, 5 Feb 2009 14:08:22 +0000 Subject: Updated example compiler plugin for SIP 00002 --- .../src/plugintemplate/TemplateComponent.scala | 2 +- .../TemplateInfoTransformComponent.scala | 2 +- .../src/plugintemplate/TemplatePlugin.scala | 2 +- .../plugintemplate/TemplateTransformComponent.scala | 2 +- .../plugintemplate/TemplateTraverseComponent.scala | 2 +- .../src/plugintemplate/standalone/PluginRunner.scala | 19 +++++++++++++------ 6 files changed, 18 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala index d740395cc8..b63f3203b5 100644 --- a/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala +++ b/docs/examples/plugintemplate/src/plugintemplate/TemplateComponent.scala @@ -14,7 +14,7 @@ import scala.tools.nsc.plugins.PluginComponent class TemplateComponent(val global: Global) extends PluginComponent { import global._ - val runsAfter = "refchecks" + val runsAfter = List[String]("refchecks") /** The name of this plugin phase * @todo Adapt to specific plugin. diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala index 60f56ba30a..71069aed6f 100644 --- a/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala +++ b/docs/examples/plugintemplate/src/plugintemplate/TemplateInfoTransformComponent.scala @@ -22,7 +22,7 @@ class TemplateInfoTransformComponent(val global: Global) extends PluginComponent import global._ import global.definitions._ - val runsAfter = "refchecks" + val runsAfter = List[String]("refchecks") /** The phase name of the compiler plugin * @todo Adapt to specific plugin. */ diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala index 658b38e58e..b241072301 100644 --- a/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala +++ b/docs/examples/plugintemplate/src/plugintemplate/TemplatePlugin.scala @@ -12,7 +12,7 @@ class TemplatePlugin(val global: Global) extends Plugin { /** The name of this plugin. Extracted from the properties file. */ val name = PluginProperties.pluginName - val runsAfter = "refchecks" + val runsAfter = List[String]("refchecks") /** A short description of the plugin, read from the properties file */ val description = PluginProperties.pluginDescription diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala index 06afedad97..7c2630dc16 100644 --- a/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala +++ b/docs/examples/plugintemplate/src/plugintemplate/TemplateTransformComponent.scala @@ -19,7 +19,7 @@ class TemplateTransformComponent(val global: Global) extends PluginComponent import global._ import global.definitions._ - val runsAfter = "refchecks" + val runsAfter = List[String]("refchecks") /** The phase name of the compiler plugin * @todo Adapt to specific plugin. */ diff --git a/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala b/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala index e87d4d18b0..400daf7437 100644 --- a/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala +++ b/docs/examples/plugintemplate/src/plugintemplate/TemplateTraverseComponent.scala @@ -9,7 +9,7 @@ class TemplateTraverseComponent (val global: Global) extends PluginComponent { import global._ import global.definitions._ - val runsAfter = "refchecks" + val runsAfter = List[String]("refchecks") /** The phase name of the compiler plugin * @todo Adapt to specific plugin. */ diff --git a/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala b/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala index 16b6ce2259..979437c8c2 100644 --- a/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala +++ b/docs/examples/plugintemplate/src/plugintemplate/standalone/PluginRunner.scala @@ -19,10 +19,17 @@ extends Global(settings, reporter) { * * @todo: Adapt to specific plugin implementation */ - override def phaseDescriptors: List[SubComponent] = List( - analyzer.namerFactory, - analyzer.typerFactory, - superAccessors, - pickler, - refchecks) ::: TemplatePlugin.components(this) + override protected def computeInternalPhases() : Unit = { + phasesSet += syntaxAnalyzer + phasesSet += (analyzer.namerFactory: SubComponent) // note: types are there because otherwise + phasesSet += (analyzer.typerFactory: SubComponent) // consistency check after refchecks would fail. + phasesSet += superAccessors // add super accessors + phasesSet += pickler // serialize symbol tables + phasesSet += refchecks // perform reference and override checking, translate nested objects + + for (phase <- TemplatePlugin.components(this)) { + phasesSet += phase + } + } + } -- cgit v1.2.3