summaryrefslogtreecommitdiff
path: root/sources/scalac/CompilerPhases.java
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-08-27 15:01:48 +0000
committerpaltherr <paltherr@epfl.ch>2003-08-27 15:01:48 +0000
commit5d5d6d1763cbabb7e4c5bbaf9ed6564f8e1cb264 (patch)
tree684c13f9962016e37a613323b5bd4eab0c8d4fba /sources/scalac/CompilerPhases.java
parentbbbecb8a613f7302541ba303ee248ef7dac089d1 (diff)
downloadscala-5d5d6d1763cbabb7e4c5bbaf9ed6564f8e1cb264.tar.gz
scala-5d5d6d1763cbabb7e4c5bbaf9ed6564f8e1cb264.tar.bz2
scala-5d5d6d1763cbabb7e4c5bbaf9ed6564f8e1cb264.zip
- Added insertion methods
- Added JavaDoc
Diffstat (limited to 'sources/scalac/CompilerPhases.java')
-rw-r--r--sources/scalac/CompilerPhases.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/sources/scalac/CompilerPhases.java b/sources/scalac/CompilerPhases.java
index 263370d91b..884ed5f52b 100644
--- a/sources/scalac/CompilerPhases.java
+++ b/sources/scalac/CompilerPhases.java
@@ -11,11 +11,16 @@ package scalac;
import java.util.List;
import java.util.ArrayList;
+/**
+ * This class defines all compiler phases and maintains a list of
+ * active phases.
+ */
public class CompilerPhases {
//########################################################################
// Public Fields
+ /** The compiler phases. */
public final PhaseDescriptor INITIAL;
public final PhaseDescriptor PARSER;
public final PhaseDescriptor ANALYZER;
@@ -39,11 +44,13 @@ public class CompilerPhases {
//########################################################################
// Private Fields
+ /** The list containing the active phases */
private final List phases;
//########################################################################
// Public Constructors
+ /** Initializes this instance. */
public CompilerPhases() {
this.phases = new ArrayList();
PhaseDescriptor[] array = {
@@ -149,12 +156,14 @@ public class CompilerPhases {
//########################################################################
// Public Methods
+ /** Returns an array containing all active phases. */
public PhaseDescriptor[] phases() {
PhaseDescriptor[] array = new PhaseDescriptor[phases.size()];
phases.toArray(array);
return array;
}
+ /** Freezes all active phases. */
public void freeze() {
PhaseDescriptor[] phases = phases();
PhaseDescriptor.freeze(phases);
@@ -162,6 +171,21 @@ public class CompilerPhases {
if (phases[i].hasSkipFlag()) remove(phases[i]);
}
+ /** Activates phase "phase" by placing it before phase "where". */
+ public void insertBefore(PhaseDescriptor phase, PhaseDescriptor where) {
+ int index = phases.indexOf(where);
+ assert index >= 0 : "could not find phase " + where;
+ phases.add(index, phase);
+ }
+
+ /** Activates phase "phase" by placing it after phase "where". */
+ public void insertAfter(PhaseDescriptor phase, PhaseDescriptor where) {
+ int index = phases.indexOf(where);
+ assert index >= 0 : "could not find phase " + where;
+ phases.add(index + 1, phase);
+ }
+
+ /** Deactivates phase "phase". */
public void remove(PhaseDescriptor phase) {
phases.remove(phase);
}