summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-12-07 14:56:23 +0000
committerpaltherr <paltherr@epfl.ch>2004-12-07 14:56:23 +0000
commitcbd30cf21cbde81a1613226e920c282bd9ebfdf7 (patch)
tree34c75a92abb6dfde4b6881162e22c24fc5fe8c48
parentb8c700cd8f89695a9086636a1bd8442ee8d43200 (diff)
downloadscala-cbd30cf21cbde81a1613226e920c282bd9ebfdf7.tar.gz
scala-cbd30cf21cbde81a1613226e920c282bd9ebfdf7.tar.bz2
scala-cbd30cf21cbde81a1613226e920c282bd9ebfdf7.zip
- Removed method Transformer.apply(CompilationU...
- Removed method Transformer.apply(CompilationUnit[] - Added method ) Phase.apply(CompilationUnit - Adapted most phases to implement method ) Phase.apply(CompilationUnit instead of Phase.apply(CompilationUnit[] )
-rw-r--r--sources/scala/tools/scalac/ast/parser/ParserPhase.scala10
-rw-r--r--sources/scala/tools/scalac/backend/GenJVMFromICodePhase.scala23
-rw-r--r--sources/scala/tools/scalac/icode/ICodePhase.scala5
-rw-r--r--sources/scala/tools/scalac/transformer/TransMatchPhase.scala9
-rw-r--r--sources/scala/tools/scalac/transformer/UnCurryPhase.scala10
-rw-r--r--sources/scala/tools/scalac/typechecker/Analyzer.scala17
-rw-r--r--sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala15
-rw-r--r--sources/scala/tools/scalac/typechecker/RefCheckPhase.scala10
-rw-r--r--sources/scala/tools/scalac/wholeprog/WholeProgPhase.scala5
-rwxr-xr-xsources/scala/tools/scaladoc/HTMLGeneratorPhase.scala6
-rw-r--r--sources/scalac/Global.java4
-rw-r--r--sources/scalac/Phase.java7
-rw-r--r--sources/scalac/ast/Transformer.java.tmpl4
-rw-r--r--sources/scalac/backend/jvm/GenJVMPhase.java6
-rw-r--r--sources/scalac/backend/msil/GenMSILPhase.java7
-rw-r--r--sources/scalac/transformer/AddAccessorsPhase.java6
-rw-r--r--sources/scalac/transformer/AddConstructorsPhase.java9
-rw-r--r--sources/scalac/transformer/AddInterfaces.java15
-rw-r--r--sources/scalac/transformer/AddInterfacesPhase.java12
-rw-r--r--sources/scalac/transformer/ErasurePhase.java4
-rw-r--r--sources/scalac/transformer/ExpandMixinsPhase.java32
-rw-r--r--sources/scalac/transformer/ExplicitOuterClassesPhase.java6
-rw-r--r--sources/scalac/transformer/ICodePhase.java3
-rw-r--r--sources/scalac/transformer/LambdaLiftPhase.java7
-rw-r--r--sources/scalac/transformer/MakeBoxingExplicitPhase.java11
-rw-r--r--sources/scalac/transformer/TailCallPhase.java6
-rw-r--r--sources/scalac/transformer/TypesAsValuesPhase.java4
-rw-r--r--sources/scalac/transformer/WholeProgPhase.java29
-rw-r--r--sources/scalac/typechecker/AnalyzerPhase.java2
-rw-r--r--sources/scalac/util/EmptyPhase.java4
30 files changed, 116 insertions, 172 deletions
diff --git a/sources/scala/tools/scalac/ast/parser/ParserPhase.scala b/sources/scala/tools/scalac/ast/parser/ParserPhase.scala
index 9c8b53fb38..e373cdc853 100644
--- a/sources/scala/tools/scalac/ast/parser/ParserPhase.scala
+++ b/sources/scala/tools/scalac/ast/parser/ParserPhase.scala
@@ -15,12 +15,10 @@ package scala.tools.scalac.ast.parser {
class ParserPhase(global: scalac_Global, descriptor: PhaseDescriptor) extends Phase(global, descriptor) {
- def apply(units: Array[CompilationUnit]): unit = {
- for (val i <- Iterator.range(0, units.length)) {
- global.start();
- units(i).body = new Parser(units(i)).parse();
- global.stop("parsed " + units(i).source);
- }
+ override def apply(unit: CompilationUnit): Unit = {
+ global.start();
+ unit.body = new Parser(unit).parse();
+ global.stop("parsed " + unit.source);
}
}
}
diff --git a/sources/scala/tools/scalac/backend/GenJVMFromICodePhase.scala b/sources/scala/tools/scalac/backend/GenJVMFromICodePhase.scala
index 3b49723c49..195d38fdd4 100644
--- a/sources/scala/tools/scalac/backend/GenJVMFromICodePhase.scala
+++ b/sources/scala/tools/scalac/backend/GenJVMFromICodePhase.scala
@@ -7,7 +7,7 @@
// $Id$
import scalac.{Global => scalac_Global}
-import scalac.{CompilationUnit => scalac_CompilationUnit}
+import scalac.CompilationUnit;
import scalac.PhaseDescriptor;
import scalac.Phase;
@@ -16,16 +16,19 @@ package scala.tools.scalac.backend {
/* This class represents the JVMFromICode backend production
* Phase. It uses the ICode to create class files using
* the JVM's bytecode */
-class GenJVMFromICodePhase(global: scalac_Global, descriptor: PhaseDescriptor) extends Phase(global, descriptor) {
+class GenJVMFromICodePhase(global0: scalac_Global, descriptor0: PhaseDescriptor) extends Phase(global0, descriptor0) {
- // ##################################################
- // Public method
+ //##########################################################################
+ // Private Fields
- /* Apply this phase to all units */
- def apply(units: Array[scalac_CompilationUnit]) = {
- val generator = new GenJVMFromICode(global); // !!! super global
- Iterator.fromArray(units).foreach(generator.translate);
- }
-}
+ private val generator = new GenJVMFromICode(global);
+
+ //##########################################################################
+ // Public Methods
+ /** Applies this phase to the given compilation unit. */
+ override def apply(unit: CompilationUnit): Unit = generator.translate(unit);
+
+ //##########################################################################
+}
}
diff --git a/sources/scala/tools/scalac/icode/ICodePhase.scala b/sources/scala/tools/scalac/icode/ICodePhase.scala
index 881e35a889..d0408b5544 100644
--- a/sources/scala/tools/scalac/icode/ICodePhase.scala
+++ b/sources/scala/tools/scalac/icode/ICodePhase.scala
@@ -31,9 +31,8 @@ class ICodePhase(global: scalac_Global, descriptor: PhaseDescriptor) extends sca
// ##################################################
// Public methods
- /** Applies this phase to the given compilation units. */
- override def apply(units: Array[CompilationUnit]): Unit =
- Iterator.fromArray(units).foreach(translate);
+ /** Applies this phase to the given compilation unit. */
+ override def apply(unit: CompilationUnit): Unit = translate(unit);
/** Prints the given compilation units. */
override def print(units: Array[CompilationUnit], printer: CodePrinter):Unit=
diff --git a/sources/scala/tools/scalac/transformer/TransMatchPhase.scala b/sources/scala/tools/scalac/transformer/TransMatchPhase.scala
index 6bb55eceb7..23dad47306 100644
--- a/sources/scala/tools/scalac/transformer/TransMatchPhase.scala
+++ b/sources/scala/tools/scalac/transformer/TransMatchPhase.scala
@@ -16,12 +16,9 @@ package scala.tools.scalac.transformer {
class TransMatchPhase(global:scalac_Global, descriptor:PhaseDescriptor )
extends Phase(global, descriptor) {
- /** Applies this phase to the given compilation units. */
- def apply( units:Array[CompilationUnit] ):unit = {
- for(val u <- units) {
- new TransMatch( global ).apply( u );
- }
- }
+ /** Applies this phase to the given compilation unit. */
+ override def apply(unit: CompilationUnit): Unit =
+ new TransMatch(global).apply(unit);
}
}
diff --git a/sources/scala/tools/scalac/transformer/UnCurryPhase.scala b/sources/scala/tools/scalac/transformer/UnCurryPhase.scala
index ecd9f76961..00843bb542 100644
--- a/sources/scala/tools/scalac/transformer/UnCurryPhase.scala
+++ b/sources/scala/tools/scalac/transformer/UnCurryPhase.scala
@@ -17,13 +17,9 @@ class UnCurryPhase(global: scalac_Global, descriptor: PhaseDescriptor) extends P
import Modifiers._;
- /** Applies this phase to the given compilation units. */
- override def apply(units: Array[CompilationUnit]) = {
- var i = 0; while (i < units.length) {
- new UnCurry(global, this).apply(units(i));
- i = i + 1
- }
- }
+ /** Applies this phase to the given compilation unit. */
+ override def apply(unit: CompilationUnit): Unit =
+ new UnCurry(global, this).apply(unit);
/** - return symbol's transformed type,
* - if symbol is a def parameter with transformed type T, return () => T
diff --git a/sources/scala/tools/scalac/typechecker/Analyzer.scala b/sources/scala/tools/scalac/typechecker/Analyzer.scala
index 0572c3a448..aa15d05f9b 100644
--- a/sources/scala/tools/scalac/typechecker/Analyzer.scala
+++ b/sources/scala/tools/scalac/typechecker/Analyzer.scala
@@ -44,7 +44,7 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
private var mode: int = _;
private var inAlternative: boolean = _;
- private var patternVars: HashMap = _; // for pattern matching; maps x to {true,false}
+ private val patternVars = new HashMap(); // for pattern matching; maps x to {true,false}
val definitions = global.definitions;
val infer = new scala.tools.scalac.typechecker.Infer(this) {
@@ -58,20 +58,6 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
type AttrInfo = Pair/*<Symbol, Array[AConstant]>*/ ;
- override def apply(units: Array[CompilationUnit]): unit = {
- {var i = 0; while (i < units.length) { lateEnter(units(i)); i = i + 1; }}
-
- val mixinOnly = global.target != Global.TARGET_INT;
- List.range(0, definitions.FUNCTION_COUNT).foreach(
- i => loadCode(definitions.FUNCTION_CLASS(i), mixinOnly));
-
- var n = 0;
- while (n < descr.newSources.size()) {
- apply(descr.newSources.get(n).asInstanceOf[CompilationUnit]);
- n = n + 1;
- }
- }
-
def enterUnit(unit: CompilationUnit): unit =
enter(
new Context(
@@ -84,7 +70,6 @@ class Analyzer(global: scalac_Global, descr: AnalyzerPhase) extends Transformer(
context.infer = infer;
this.unit = unit;
this.context = context;
- this.patternVars = new HashMap();
descr.contexts.put(unit, context);
enterSyms(unit.body);
this.unit = null;
diff --git a/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala b/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala
index a894e7cc8b..1baf5251a7 100644
--- a/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala
+++ b/sources/scala/tools/scalac/typechecker/AnalyzerPhase.scala
@@ -53,6 +53,15 @@ class AnalyzerPhase(global: scalac_Global, descriptor: PhaseDescriptor) extends
val newSources = new ArrayList/*<CompilationUnit>*/();
override def getUnits(): Array[CompilationUnit] = {
+ val analyzer = new Analyzer(global, this);
+ val mixinOnly = global.target != Global.TARGET_INT;
+ List.range(0, global.definitions.FUNCTION_COUNT).foreach(
+ i => analyzer.loadCode(global.definitions.FUNCTION_CLASS(i), mixinOnly));
+ var n = 0;
+ while (n < newSources.size()) {
+ analyzer.apply(newSources.get(n).asInstanceOf[CompilationUnit]);
+ n = n + 1;
+ }
val array = new Array[CompilationUnit](newSources.size());
newSources.toArray(array.asInstanceOf[Array[Object]]);
newSources.clear();
@@ -71,12 +80,8 @@ class AnalyzerPhase(global: scalac_Global, descriptor: PhaseDescriptor) extends
c
}
- override def apply(units: Array[CompilationUnit]): unit =
- new Analyzer(global, this).apply(units);
-
- override def lateEnter(unit: CompilationUnit): unit = {
+ override def apply(unit: CompilationUnit): Unit =
new Analyzer(global, this).lateEnter(unit);
- }
}
}
diff --git a/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala b/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala
index e3d5aa22ab..accf608d0b 100644
--- a/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala
+++ b/sources/scala/tools/scalac/typechecker/RefCheckPhase.scala
@@ -18,13 +18,9 @@ import scalac.util.NewArray;
class RefCheckPhase(global: scalac_Global, descriptor: PhaseDescriptor)
extends Phase(global, descriptor) {
- /** Applies this phase to the given compilation units. */
- def apply(units: Array[CompilationUnit]) = {
- var i = 0; while (i < units.length) {
- new RefCheck(global.asInstanceOf[scalac.Global]).apply(units(i));
- i = i + 1
- }
- }
+ /** Applies this phase to the given compilation unit. */
+ override def apply(unit: CompilationUnit): Unit =
+ new RefCheck(global.asInstanceOf[scalac.Global]).apply(unit);
override def transformInfo(sym: Symbol, tp: Type): Type =
if (sym.isModule() && !sym.isStatic()) new Type$PolyType(Symbol.EMPTY_ARRAY, tp);
diff --git a/sources/scala/tools/scalac/wholeprog/WholeProgPhase.scala b/sources/scala/tools/scalac/wholeprog/WholeProgPhase.scala
index 5a6f8a8295..b032b59a21 100644
--- a/sources/scala/tools/scalac/wholeprog/WholeProgPhase.scala
+++ b/sources/scala/tools/scalac/wholeprog/WholeProgPhase.scala
@@ -13,12 +13,11 @@
**
** [iuli] 3.03.2004 */
-import scala.tools.scalac.{CompilerPhases => old_CompilerPhases}
import scalac.{Global => scalac_Global}
import scalac.transformer.{WholeProgPhase => scalac_WholeProgPhase}
import scalac.PhaseDescriptor;
import scalac.CompilationUnit;
-import scalac.util.Name;
+import scalac.util.Debug;
package scala.tools.scalac.wholeprog {
@@ -51,6 +50,8 @@ class WholeProgPhase(global: scalac_Global, descriptor: PhaseDescriptor)
}
}
+ override def apply(unit: CompilationUnit): Unit = throw Debug.abort("!!!");
+
}
}
diff --git a/sources/scala/tools/scaladoc/HTMLGeneratorPhase.scala b/sources/scala/tools/scaladoc/HTMLGeneratorPhase.scala
index 0b403728a4..05f7eb72de 100755
--- a/sources/scala/tools/scaladoc/HTMLGeneratorPhase.scala
+++ b/sources/scala/tools/scaladoc/HTMLGeneratorPhase.scala
@@ -10,6 +10,7 @@ import scalac.Global;
import scalac.Phase;
import scalac.PhaseDescriptor;
import scalac.CompilationUnit;
+import scalac.util.Debug;
package scala.tools.scaladoc {
@@ -17,11 +18,14 @@ class HTMLGeneratorPhase(global: Global, descriptor: PhaseDescriptor)
extends Phase(global, descriptor)
{
- def apply(units: Array[CompilationUnit]): Unit =
+ override def apply(units: Array[CompilationUnit]): Unit =
(new HTMLGenerator(global) {
def newTypeIso(global: Global): TypeIsomorphism = new ScalaML(global);
}).apply();
+ override def apply(unit: CompilationUnit): Unit =
+ throw Debug.abort("!!!");
+
}
}
diff --git a/sources/scalac/Global.java b/sources/scalac/Global.java
index bfba148993..ec8f20ab81 100644
--- a/sources/scalac/Global.java
+++ b/sources/scalac/Global.java
@@ -389,9 +389,9 @@ public abstract class Global {
start();
// System.out.println("*** " + currentPhase.descriptor.description() + " ***");
currentPhase.apply(units);
- stop(currentPhase.descriptor.taskDescription());
if (currentPhase == PHASE.ANALYZER.phase())
units = ((AnalyzerPhase)currentPhase).getUnits();
+ stop(currentPhase.descriptor.taskDescription());
if (currentPhase.descriptor.hasPrintFlag()) print(units);
// if (currentPhase.descriptor.hasGraphFlag()) // !!!
// if (currentPhase.descriptor.hasCheckFlag()) // !!!
@@ -423,7 +423,7 @@ public abstract class Global {
currentPhase = PHASE.PARSER.phase();
PHASE.PARSER.phase().apply(new CompilationUnit[] {unit});
currentPhase = PHASE.ANALYZER.phase();
- ((AnalyzerPhase)PHASE.ANALYZER.phase()).lateEnter(unit);
+ ((AnalyzerPhase)PHASE.ANALYZER.phase()).apply(unit);
// !!! add code for later phases?
currentPhase = backup;
}
diff --git a/sources/scalac/Phase.java b/sources/scalac/Phase.java
index cd3c1a1d5d..88420302e9 100644
--- a/sources/scalac/Phase.java
+++ b/sources/scalac/Phase.java
@@ -62,7 +62,12 @@ public abstract class Phase {
}
/** Applies this phase to the given compilation units. */
- public abstract void apply(CompilationUnit[] units);
+ public void apply(CompilationUnit[] units) {
+ for (int i = 0; i < units.length; i++) apply(units[i]);
+ }
+
+ /** Applies this phase to the given compilation unit. */
+ public abstract void apply(CompilationUnit unit);
/** Returns the name of this phase. */
public final String toString() {
diff --git a/sources/scalac/ast/Transformer.java.tmpl b/sources/scalac/ast/Transformer.java.tmpl
index 189a8a8d6d..bf5fa09f4f 100644
--- a/sources/scalac/ast/Transformer.java.tmpl
+++ b/sources/scalac/ast/Transformer.java.tmpl
@@ -55,10 +55,6 @@ public class Transformer {
//########################################################################
// Public Methods
- public void apply(CompilationUnit[] units) {
- for (int i = 0; i < units.length; i++) apply(units[i]);
- }
-
public void apply(CompilationUnit unit) {
unit.global.log("transforming " + unit);
unit.body = transform(unit.body);
diff --git a/sources/scalac/backend/jvm/GenJVMPhase.java b/sources/scalac/backend/jvm/GenJVMPhase.java
index eb02e0645c..06d39839c8 100644
--- a/sources/scalac/backend/jvm/GenJVMPhase.java
+++ b/sources/scalac/backend/jvm/GenJVMPhase.java
@@ -40,9 +40,9 @@ public class GenJVMPhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- for (int i = 0; i < units.length; i++) translator.translate(units[i]);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ translator.translate(unit);
}
//########################################################################
diff --git a/sources/scalac/backend/msil/GenMSILPhase.java b/sources/scalac/backend/msil/GenMSILPhase.java
index a12a0c2d52..0df65a1eb8 100644
--- a/sources/scalac/backend/msil/GenMSILPhase.java
+++ b/sources/scalac/backend/msil/GenMSILPhase.java
@@ -49,9 +49,14 @@ public class GenMSILPhase extends Phase {
tc.init();
tc.collectSymbols(units);
tc.initAssembly();
- for (int i = 0; i < units.length; i++) translator.apply(units[i]);
+ super.apply(units);
tc.saveAssembly();
}
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ translator.apply(unit);
+ }
+
//########################################################################
}
diff --git a/sources/scalac/transformer/AddAccessorsPhase.java b/sources/scalac/transformer/AddAccessorsPhase.java
index f9a459722b..2f684e1acb 100644
--- a/sources/scalac/transformer/AddAccessorsPhase.java
+++ b/sources/scalac/transformer/AddAccessorsPhase.java
@@ -45,9 +45,9 @@ public class AddAccessorsPhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- treeTransformer.apply(units);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ treeTransformer.apply(unit);
}
//########################################################################
diff --git a/sources/scalac/transformer/AddConstructorsPhase.java b/sources/scalac/transformer/AddConstructorsPhase.java
index a60842da9f..1dfb10e344 100644
--- a/sources/scalac/transformer/AddConstructorsPhase.java
+++ b/sources/scalac/transformer/AddConstructorsPhase.java
@@ -24,7 +24,7 @@ public class AddConstructorsPhase extends Phase {
//########################################################################
// Private Fields
- /** A maps from old constructor symbols to new ones */
+ /** A map from old constructor symbols to new ones */
private final HashMap/*<Symbol,Symbol>*/ constructors = new HashMap();
//########################################################################
@@ -54,10 +54,9 @@ public class AddConstructorsPhase extends Phase {
return type;
}
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- for (int i = 0; i < units.length; i++)
- new AddConstructors(global, constructors).apply(units[i]);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ new AddConstructors(global, constructors).apply(unit);
}
//########################################################################
diff --git a/sources/scalac/transformer/AddInterfaces.java b/sources/scalac/transformer/AddInterfaces.java
index c5b6b94fab..5722cf4396 100644
--- a/sources/scalac/transformer/AddInterfaces.java
+++ b/sources/scalac/transformer/AddInterfaces.java
@@ -221,20 +221,21 @@ public class AddInterfaces extends GenTransformer {
}
/**
- * Returns the tree of the given class whose body is built by
- * adding to the given body the class members. Non-abstract
- * methods are removed from the ngiven method map. All other
- * members are generated from their symbol.
+ * Returns the tree of the given class. Its body is built by
+ * adding its members to the provided body. Non-abstract methods
+ * are removed from the provided method map. All other members are
+ * generated from their symbol.
*/
private Tree getClassTree(Symbol clasz, TreeList body, Map methods) {
Scope members = clasz.nextInfo().members();
- for (Scope.SymbolIterator i = members.iterator();
- i.hasNext(); ) {
+ for (Scope.SymbolIterator i = members.iterator(); i.hasNext(); ) {
Symbol member = i.next();
if (!member.isTerm()) continue;
body.append(getMemberTree(clasz, member, methods));
}
- return gen.ClassDef(clasz, body.toArray());
+ Tree[] array = body.toArray();
+ if (!clasz.isInterface()) phase.classToBody.put(clasz, array);
+ return gen.ClassDef(clasz, array);
}
/**
diff --git a/sources/scalac/transformer/AddInterfacesPhase.java b/sources/scalac/transformer/AddInterfacesPhase.java
index e018abb00e..9b2447b119 100644
--- a/sources/scalac/transformer/AddInterfacesPhase.java
+++ b/sources/scalac/transformer/AddInterfacesPhase.java
@@ -24,10 +24,9 @@ public class AddInterfacesPhase extends Phase {
super(global, descriptor);
}
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- for (int i = 0; i < units.length; i++)
- new AddInterfaces(global, this).apply(units[i]);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ new AddInterfaces(global, this).apply(unit);
}
public Type transformInfo(Symbol sym, Type tp) {
@@ -139,8 +138,9 @@ public class AddInterfacesPhase extends Phase {
else return className;
}
- protected HashMap ifaceToClass = new HashMap();
- protected HashMap classToIFace = new HashMap();
+ protected final HashMap/*<Symbol,Symbol>*/ ifaceToClass = new HashMap();
+ protected final HashMap/*<Symbol,Symbol>*/ classToIFace = new HashMap();
+ protected final HashMap/*<Symbol,Tree[]>*/ classToBody = new HashMap();
/** Return the class symbol corresponding to the given interface
* symbol. If the class does not need an interface, return the
diff --git a/sources/scalac/transformer/ErasurePhase.java b/sources/scalac/transformer/ErasurePhase.java
index cfe2e20da6..c0669e22f2 100644
--- a/sources/scalac/transformer/ErasurePhase.java
+++ b/sources/scalac/transformer/ErasurePhase.java
@@ -45,8 +45,8 @@ public class ErasurePhase extends Phase {
//########################################################################
// Public Methods
- public void apply(CompilationUnit[] units) {
- erasure.apply(units);
+ public void apply(CompilationUnit unit) {
+ erasure.apply(unit);
}
public Type transformInfo(Symbol sym, Type tp) {
diff --git a/sources/scalac/transformer/ExpandMixinsPhase.java b/sources/scalac/transformer/ExpandMixinsPhase.java
index f2851ea156..9f00dd9c41 100644
--- a/sources/scalac/transformer/ExpandMixinsPhase.java
+++ b/sources/scalac/transformer/ExpandMixinsPhase.java
@@ -68,9 +68,6 @@ public class ExpandMixinsPhase extends Phase {
private final Map/*<Symbol,Tree[]>*/ bodies;
- /** A traverser that collects class definitions */
- private final Traverser collector;
-
/** A transformer that expands classes that have mixins */
private final GenTransformer expander;
@@ -84,18 +81,16 @@ public class ExpandMixinsPhase extends Phase {
this.interfaces = ((AddInterfacesPhase)addinterfaces).classToIFace;
this.transformers = new HashMap();
this.expansions = new HashMap();
- this.bodies = new HashMap();
- this.collector = new TreeCollector();
+ this.bodies = ((AddInterfacesPhase)addinterfaces).classToBody;
this.expander = new TreeExpander(global);
}
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- collector.traverse(units);
- expander.apply(units);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ expander.apply(unit);
}
/** Applies this phase to the given type for the given symbol. */
@@ -117,25 +112,6 @@ public class ExpandMixinsPhase extends Phase {
// Private Methods
//########################################################################
- // Private Class - Tree collector
-
- /** A tree traverser that collects class definitions. */
- private class TreeCollector extends Traverser {
- public void traverse(Tree tree) {
- switch(tree) {
- case ClassDef(_, _, _, _, _, Template(_, Tree[] body)):
- Symbol clasz = tree.symbol();
- if (!clasz.isInterface()) bodies.put(clasz, body);
- traverse(body);
- return;
- case PackageDef(_, Template(_, Tree[] body)):
- traverse(body);
- return;
- }
- }
- }
-
- //########################################################################
// Private Class - Tree expander
/**
diff --git a/sources/scalac/transformer/ExplicitOuterClassesPhase.java b/sources/scalac/transformer/ExplicitOuterClassesPhase.java
index e8cd8fe9a9..b1b05832a1 100644
--- a/sources/scalac/transformer/ExplicitOuterClassesPhase.java
+++ b/sources/scalac/transformer/ExplicitOuterClassesPhase.java
@@ -64,9 +64,9 @@ public class ExplicitOuterClassesPhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- treeTransformer.apply(units);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ treeTransformer.apply(unit);
}
/** Applies this phase to the given type for the given symbol. */
diff --git a/sources/scalac/transformer/ICodePhase.java b/sources/scalac/transformer/ICodePhase.java
index 7ac77cb11f..3274897641 100644
--- a/sources/scalac/transformer/ICodePhase.java
+++ b/sources/scalac/transformer/ICodePhase.java
@@ -35,9 +35,6 @@ public abstract class ICodePhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public abstract void apply(CompilationUnit[] units);
-
/** Prints the given compilation units. */
public abstract void print(CompilationUnit[] units, CodePrinter printer);
diff --git a/sources/scalac/transformer/LambdaLiftPhase.java b/sources/scalac/transformer/LambdaLiftPhase.java
index e72575a707..42bf473112 100644
--- a/sources/scalac/transformer/LambdaLiftPhase.java
+++ b/sources/scalac/transformer/LambdaLiftPhase.java
@@ -21,10 +21,9 @@ public class LambdaLiftPhase extends Phase implements Kinds, Modifiers {
super(global, descriptor);
}
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- for (int i = 0; i < units.length; i++)
- new LambdaLift(global, this).apply(units[i]);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ new LambdaLift(global, this).apply(unit);
}
public Type transformInfo(Symbol sym, Type tp) {
diff --git a/sources/scalac/transformer/MakeBoxingExplicitPhase.java b/sources/scalac/transformer/MakeBoxingExplicitPhase.java
index e4d6f956b1..435886b1dc 100644
--- a/sources/scalac/transformer/MakeBoxingExplicitPhase.java
+++ b/sources/scalac/transformer/MakeBoxingExplicitPhase.java
@@ -40,13 +40,10 @@ public class MakeBoxingExplicitPhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- for (int i = 0; i < units.length; i++) {
- assert checker.check(units[i]);
- new scalac.atree.ATreeFromSTree(global.definitions)
- .translate(units[i]); // !!!
- }
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ assert checker.check(unit);
+ new scalac.atree.ATreeFromSTree(definitions).translate(unit); // !!!
}
//########################################################################
diff --git a/sources/scalac/transformer/TailCallPhase.java b/sources/scalac/transformer/TailCallPhase.java
index 667e906112..2487a7d436 100644
--- a/sources/scalac/transformer/TailCallPhase.java
+++ b/sources/scalac/transformer/TailCallPhase.java
@@ -60,9 +60,9 @@ public class TailCallPhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- treeTransformer.apply(units);
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
+ treeTransformer.apply(unit);
}
//########################################################################
diff --git a/sources/scalac/transformer/TypesAsValuesPhase.java b/sources/scalac/transformer/TypesAsValuesPhase.java
index f8b90aee8a..217ed6553e 100644
--- a/sources/scalac/transformer/TypesAsValuesPhase.java
+++ b/sources/scalac/transformer/TypesAsValuesPhase.java
@@ -300,8 +300,8 @@ public class TypesAsValuesPhase extends Phase {
return !classSym.owner().isPackageClass();
}
- public void apply(CompilationUnit[] units) {
- transformer.apply(units);
+ public void apply(CompilationUnit unit) {
+ transformer.apply(unit);
}
private class TV_Transformer extends GenTransformer {
diff --git a/sources/scalac/transformer/WholeProgPhase.java b/sources/scalac/transformer/WholeProgPhase.java
index 5ad7d271e7..7591352c21 100644
--- a/sources/scalac/transformer/WholeProgPhase.java
+++ b/sources/scalac/transformer/WholeProgPhase.java
@@ -11,35 +11,22 @@ package scalac.transformer;
import scalac.Global;
import scalac.Phase;
import scalac.PhaseDescriptor;
-import scalac.CompilationUnit;
-import scalac.symtab.Definitions;
-
-import ch.epfl.lamp.util.CodePrinter;
-import scalac.atree.ATreePrinter;
-
/**
- * This class represents the wholeprog phase for the java version
- * of the compiler. It doesn't do anything but permit to make
- * a bridge between the java implementation of Socos et the
- * scala one. See scala.tools.scalac.wholeprog.WholeProgPhase for
- * implementation
+ * This class represents the wholeprog phase for the java version of
+ * the compiler. It doesn't do anything but permit to make a bridge
+ * between the java implementation of Socos and the scala one. See
+ * scala.tools.scalac.wholeprog.WholeProgPhase for implementation.
*/
-public class WholeProgPhase extends Phase {
+public abstract class WholeProgPhase extends Phase {
+
+ //########################################################################
+ // Public Constructors
/** Initializes this instance. */
public WholeProgPhase(Global global, PhaseDescriptor descriptor) {
super(global, descriptor);
-
}
//########################################################################
- // Public Methods
-
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
- // This java version doesn't make anything
- }
-
}
-
diff --git a/sources/scalac/typechecker/AnalyzerPhase.java b/sources/scalac/typechecker/AnalyzerPhase.java
index c4f56d22e8..0939806844 100644
--- a/sources/scalac/typechecker/AnalyzerPhase.java
+++ b/sources/scalac/typechecker/AnalyzerPhase.java
@@ -29,8 +29,6 @@ public abstract class AnalyzerPhase extends Phase {
public abstract void addConsoleImport(Symbol module);
- public abstract void lateEnter(CompilationUnit unit);
-
public abstract CompilationUnit[] getUnits();
}
diff --git a/sources/scalac/util/EmptyPhase.java b/sources/scalac/util/EmptyPhase.java
index 003983f4e0..5600fc85b9 100644
--- a/sources/scalac/util/EmptyPhase.java
+++ b/sources/scalac/util/EmptyPhase.java
@@ -27,8 +27,8 @@ public class EmptyPhase extends Phase {
//########################################################################
// Public Methods
- /** Applies this phase to the given compilation units. */
- public void apply(CompilationUnit[] units) {
+ /** Applies this phase to the given compilation unit. */
+ public void apply(CompilationUnit unit) {
// do nothing
}