summaryrefslogtreecommitdiff
path: root/sources/scalac/Phase.java
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-02-13 14:41:36 +0000
committerMartin Odersky <odersky@gmail.com>2003-02-13 14:41:36 +0000
commit4177daab2f54bdb20c71f623296a8bb32616fd12 (patch)
tree23f08b43f3758e825d5965b336030603a65bbcf7 /sources/scalac/Phase.java
parent33d6e170c97ca7b2f991896a0729941a7240b6d6 (diff)
downloadscala-4177daab2f54bdb20c71f623296a8bb32616fd12.tar.gz
scala-4177daab2f54bdb20c71f623296a8bb32616fd12.tar.bz2
scala-4177daab2f54bdb20c71f623296a8bb32616fd12.zip
Initial version.
Diffstat (limited to 'sources/scalac/Phase.java')
-rw-r--r--sources/scalac/Phase.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/sources/scalac/Phase.java b/sources/scalac/Phase.java
new file mode 100644
index 0000000000..bbce46e013
--- /dev/null
+++ b/sources/scalac/Phase.java
@@ -0,0 +1,45 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+** **
+** $Id$
+\* */
+
+package scalac;
+
+/** Representation of a compiler phase. PhaseDescriptors create
+ * phase. Phases operate subsequently on all compilation units.
+ *
+ * @author Matthias Zenger
+ * @version 1.0
+ */
+public abstract class Phase {
+
+ /** the global environment
+ */
+ public final Global global;
+
+ /** the descriptor for this phase
+ */
+ public final PhaseDescriptor descr;
+
+ /** constructor
+ */
+ public Phase(Global global, PhaseDescriptor descr) {
+ this.global = global;
+ this.descr = descr;
+ }
+
+ /** apply this phase to all compilation units
+ */
+ public void apply() {
+ for (int i = 0; i < global.units.length; i++) {
+ apply(global.units[i]);
+ }
+ }
+
+ /** apply this phase to the given compilation unit
+ */
+ public abstract void apply(Unit unit);
+}