diff options
Diffstat (limited to 'sources/scalac/typechecker')
-rw-r--r-- | sources/scalac/typechecker/Analyzer.java | 12 | ||||
-rw-r--r-- | sources/scalac/typechecker/AnalyzerPhase.java | 35 | ||||
-rw-r--r-- | sources/scalac/typechecker/RefCheckPhase.java | 25 |
3 files changed, 25 insertions, 47 deletions
diff --git a/sources/scalac/typechecker/Analyzer.java b/sources/scalac/typechecker/Analyzer.java index 1398d150c4..296f20dc76 100644 --- a/sources/scalac/typechecker/Analyzer.java +++ b/sources/scalac/typechecker/Analyzer.java @@ -54,11 +54,13 @@ public class Analyzer extends Transformer implements Modifiers, Kinds { private boolean inAlternative; // for pattern matching; private HashMap patternVars; // for pattern matching; maps x to {true,false} - public void apply() { - for (int i = 0; i < global.units.length; i++) { - enterUnit(global.units[i]); - } - super.apply(); // this calls apply(u) for every unit `u'. + public void apply(Unit[] units) { +// for (int i = 0; i < units.length; i++) { +// enterUnit(global.units[i]); +// } +// super.apply(units); // this calls apply(u) for every unit `u'. + for (int i = 0; i < units.length; i++) enterUnit(units[i]); + super.apply(units); // this calls apply(u) for every unit `u'. int n = descr.newSources.size(); while (n > 0) { int l = global.units.length; diff --git a/sources/scalac/typechecker/AnalyzerPhase.java b/sources/scalac/typechecker/AnalyzerPhase.java index 158b7dd530..2b7d0fa886 100644 --- a/sources/scalac/typechecker/AnalyzerPhase.java +++ b/sources/scalac/typechecker/AnalyzerPhase.java @@ -17,15 +17,16 @@ import scalac.checkers.*; import java.util.HashMap; import java.util.ArrayList; -public class AnalyzerPhase extends PhaseDescriptor { +public class AnalyzerPhase extends Phase { - /* final */ Context startContext; - /* final */ Context consoleContext; - HashMap/*<Unit,Context>*/ contexts = new HashMap(); - ArrayList/*<Unit>*/ newSources = new ArrayList(); + final Context startContext; + final Context consoleContext; + final HashMap/*<Unit,Context>*/ contexts = new HashMap(); + final ArrayList/*<Unit>*/ newSources = new ArrayList(); - public void initialize(Global global, int id) { - super.initialize(global, id); + /** Initializes this instance. */ + public AnalyzerPhase(Global global, PhaseDescriptor descriptor) { + super(global, descriptor); Definitions definitions = global.definitions; this.startContext = new Context( Tree.Empty, @@ -102,24 +103,8 @@ public class AnalyzerPhase extends PhaseDescriptor { importConsole, new Scope(), consoleContext.imports); } - public String name() { - return "analyze"; - } - - public String description () { - return "name and type analysis"; - } - - public String taskDescription() { - return "type checking"; - } - - public void apply(Global global) { - new Analyzer(global, this).apply(); - } - - public void apply(Unit unit) { - new Analyzer(unit.global, this).apply(unit); + public void apply(Unit[] units) { + new Analyzer(global, this).apply(units); } public void lateEnter(Global global, Unit unit, Symbol symbol) { diff --git a/sources/scalac/typechecker/RefCheckPhase.java b/sources/scalac/typechecker/RefCheckPhase.java index bfaa1e4fc4..7749e4b357 100644 --- a/sources/scalac/typechecker/RefCheckPhase.java +++ b/sources/scalac/typechecker/RefCheckPhase.java @@ -12,26 +12,17 @@ import scalac.*; import scalac.ast.*; import scalac.checkers.*; -public class RefCheckPhase extends PhaseDescriptor { +public class RefCheckPhase extends Phase { - public String name() { - return "refcheck"; + /** Initializes this instance. */ + public RefCheckPhase(Global global, PhaseDescriptor descriptor) { + super(global, descriptor); } - public String description () { - return "reference checking"; - } - - public String taskDescription () { - return "reference checking"; - } - - public void apply(Global global) { - new RefCheck(global).apply(); - } - - public void apply(Unit unit) { - new RefCheck(unit.global).apply(unit); + /** Applies this phase to the given compilation units. */ + public void apply(Unit[] units) { + for (int i = 0; i < units.length; i++) + new RefCheck(global).apply(units[i]); } public Checker[] postCheckers(Global global) { |