summaryrefslogtreecommitdiff
path: root/sources/scalac/PhaseDescriptor.java
diff options
context:
space:
mode:
authorMatthias Zenger <mzenger@gmail.com>2003-07-02 12:40:42 +0000
committerMatthias Zenger <mzenger@gmail.com>2003-07-02 12:40:42 +0000
commit5bcdedd615aaa18c44b408db74776949f09e307d (patch)
treedffc1b3bbbe517a818c44cb19686fd0f5e6f876a /sources/scalac/PhaseDescriptor.java
parent478c334b562ff810f424b8ac3cdfd7f9c868feab (diff)
downloadscala-5bcdedd615aaa18c44b408db74776949f09e307d.tar.gz
scala-5bcdedd615aaa18c44b408db74776949f09e307d.tar.bz2
scala-5bcdedd615aaa18c44b408db74776949f09e307d.zip
Added a new apply method to each phase which al...
Added a new apply method to each phase which allows to apply only a single compilation unit. For some phases this might probably not work as it is right now. At some stage, these phases have to be adapted accordingly.
Diffstat (limited to 'sources/scalac/PhaseDescriptor.java')
-rw-r--r--sources/scalac/PhaseDescriptor.java27
1 files changed, 17 insertions, 10 deletions
diff --git a/sources/scalac/PhaseDescriptor.java b/sources/scalac/PhaseDescriptor.java
index 6597dc9e5e..e555383fac 100644
--- a/sources/scalac/PhaseDescriptor.java
+++ b/sources/scalac/PhaseDescriptor.java
@@ -33,9 +33,11 @@ public abstract class PhaseDescriptor {
return "initializing compiler";
}
- /** apply phase to all compilation units
- */
- public void apply(Global global) {}
+ /** apply phase to all compilation units
+ */
+ public void apply(Global global) {}
+
+ public void apply(Unit unit) {}
}
private static class TerminalPhaseDescriptor extends PhaseDescriptor {
@@ -48,9 +50,11 @@ public abstract class PhaseDescriptor {
return "compilation terminated ";
}
- /** apply phase to all compilation units
- */
- public void apply(Global global) {}
+ /** apply phase to all compilation units
+ */
+ public void apply(Global global) {}
+
+ public void apply(Unit unit) {}
}
public static PhaseDescriptor INITIAL = new InitialPhaseDescriptor();
@@ -93,13 +97,17 @@ public abstract class PhaseDescriptor {
* Return the info of `sym' after the phase.
*/
public Type transformInfo(Symbol sym, Type tp) {
- return tp;
+ return tp;
}
/** apply phase to all compilation units
*/
public abstract void apply(Global global);
+ /** apply this phase to a compilation unit
+ */
+ public abstract void apply(Unit unit);
+
/** check all compilation units
*/
public void check(Global global) {
@@ -111,7 +119,6 @@ public abstract class PhaseDescriptor {
*/
public void print(Global global) {
TreePrinter printer = global.printer;
-
printer.beginSection(1, "Trees after phase " + name());
for (int i = 0; i < global.units.length; i++)
printer.print(global.units[i]);
@@ -141,10 +148,10 @@ public abstract class PhaseDescriptor {
/** graph the result of this phase for the given compilation unit
*/
public void graph(Unit unit) {
- /* todo: uncomment
+ /* todo: uncomment
new scala.compiler.gdl.TreePrinter().printInFile(
unit, unit.source + "-" + name() + ".gdl");
- */
+ */
}
public String toString() {