diff options
author | paltherr <paltherr@epfl.ch> | 2003-03-21 16:42:56 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-03-21 16:42:56 +0000 |
commit | e2a09f258a66f71ea90e65b645d8a03b1a64be71 (patch) | |
tree | 22c62210a3cfc5fa5eb28d657399e560cf738e1d /sources/scalac/ast | |
parent | 787d4bb9dbc540a61632c1f234a54ab74a69609c (diff) | |
download | scala-e2a09f258a66f71ea90e65b645d8a03b1a64be71.tar.gz scala-e2a09f258a66f71ea90e65b645d8a03b1a64be71.tar.bz2 scala-e2a09f258a66f71ea90e65b645d8a03b1a64be71.zip |
- Removed method createPhase in class PhaseDesc...
- Removed method createPhase in class PhaseDescriptor Made method apply
- abstract in class PhaseDescriptor Implemented method apply in all
- subclasses of class PhaseDescriptor
Diffstat (limited to 'sources/scalac/ast')
-rw-r--r-- | sources/scalac/ast/parser/ParserPhase.java | 44 |
1 files changed, 10 insertions, 34 deletions
diff --git a/sources/scalac/ast/parser/ParserPhase.java b/sources/scalac/ast/parser/ParserPhase.java index 204fb2b925..1a1dde1ffe 100644 --- a/sources/scalac/ast/parser/ParserPhase.java +++ b/sources/scalac/ast/parser/ParserPhase.java @@ -2,14 +2,15 @@ ** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala ** ** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL ** ** /_____/\____/\___/\____/____/ ** -** -** $Id$ \* */ +// $Id$ + package scalac.ast.parser; -import java.io.*; -import scalac.*; +import scalac.Global; +import scalac.Unit; +import scalac.PhaseDescriptor; public class ParserPhase extends PhaseDescriptor { @@ -25,39 +26,14 @@ public class ParserPhase extends PhaseDescriptor { return "parsed"; } - public Phase createPhase(Global global) { - return new ParserWorker(global, this); - } -} - -public class ParserWorker extends Phase { - - /** constructor - */ - public ParserWorker(Global global, PhaseDescriptor descr) { - super(global, descr); - } - - /** apply this phase to all compilation units - */ - public void apply() { - super.apply(); - int count = 0; - for (int i = 0; i < global.units.length; i++) { - if (global.units[i].body != null) count++; - } - Unit[] units = new Unit[count]; - for (int i = 0, j = 0; i < global.units.length; i++) { - if (global.units[i].body != null) units[j++] = global.units[i]; - } - global.units = units; + public void apply(Global global) { + for (int i = 0; i < global.units.length; i++) apply(global.units[i]); } - /** apply this phase to the given compilation unit - */ public void apply(Unit unit) { - global.start(); + unit.global.start(); unit.body = new Parser(unit).parse(); - global.stop("parsed " + unit.source); + unit.global.stop("parsed " + unit.source); } + } |