summaryrefslogtreecommitdiff
path: root/sources/scalac/Phase.java
blob: bbce46e0136a1bd13c3235b39003ca66764487f2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
}