summaryrefslogtreecommitdiff
path: root/sources/scalac/util
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-08-18 15:58:45 +0000
committerpaltherr <paltherr@epfl.ch>2003-08-18 15:58:45 +0000
commit87210b8f1092065be1b7cfaf13a3852fe861abe4 (patch)
tree0e2ee43a75d151a74cec60e0025876082f2d7bc5 /sources/scalac/util
parentc4e1967d6c99021400b8fa906f51f0bcba984fd4 (diff)
downloadscala-87210b8f1092065be1b7cfaf13a3852fe861abe4.tar.gz
scala-87210b8f1092065be1b7cfaf13a3852fe861abe4.tar.bz2
scala-87210b8f1092065be1b7cfaf13a3852fe861abe4.zip
- rewrote the phase creation process
- replace PhaseRepository by CompilerPhases
Diffstat (limited to 'sources/scalac/util')
-rw-r--r--sources/scalac/util/EmptyPhase.java36
-rw-r--r--sources/scalac/util/OptionParser.java7
2 files changed, 40 insertions, 3 deletions
diff --git a/sources/scalac/util/EmptyPhase.java b/sources/scalac/util/EmptyPhase.java
new file mode 100644
index 0000000000..84ffe81adf
--- /dev/null
+++ b/sources/scalac/util/EmptyPhase.java
@@ -0,0 +1,36 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+\* */
+
+// $Id$
+
+package scalac.util;
+
+import scalac.Global;
+import scalac.Phase;
+import scalac.PhaseDescriptor;
+import scalac.Unit;
+
+/** This class implements a phase that does nothing. */
+public class EmptyPhase extends Phase {
+
+ //########################################################################
+ // Public Constructors
+
+ /** Initializes this instance. */
+ public EmptyPhase(Global global, PhaseDescriptor descriptor) {
+ super(global, descriptor);
+ }
+
+ //########################################################################
+ // Public Methods
+
+ /** Applies this phase to the given compilation units. */
+ public void apply(Unit[] units) {
+ // do nothing
+ }
+
+ //########################################################################
+}
diff --git a/sources/scalac/util/OptionParser.java b/sources/scalac/util/OptionParser.java
index c2c3af6e6f..b82c147f9c 100644
--- a/sources/scalac/util/OptionParser.java
+++ b/sources/scalac/util/OptionParser.java
@@ -414,15 +414,16 @@ public class PhaseSetOptionParser extends OptionParser {
public void consumePhase(String token) {
if (token.equals("all")) {
- for (int i = 0; i < phases.length; i++) phases[i].flags |= flag;
+ for (int i = 0; i < phases.length; i++)
+ phases[i].addFlag(flag, false);
return;
}
PhaseDescriptor phase = lookup(getPhaseName(token));
if (phase != null) {
boolean before = getBeforeFlag(token);
boolean after = getAfterFlag(token) || !before;
- if (before) phase.flags |= flag << 16;
- if (after) phase.flags |= flag;
+ if (before) phase.addFlag(flag, true);
+ if (after) phase.addFlag(flag, false);
}
}