|
Revision 2404, 1.2 KB
(checked in by mspiegel, 16 months ago)
|
|
[static analysis] Another refactoring of Shell.java. Static phases are now declared in package com.sun.fortress.compiler.phases.
|
| Line | |
|---|
| 1 | package com.sun.fortress.compiler.phases; |
|---|
| 2 | |
|---|
| 3 | import com.sun.fortress.compiler.AnalyzeResult; |
|---|
| 4 | import com.sun.fortress.compiler.GlobalEnvironment; |
|---|
| 5 | import com.sun.fortress.exceptions.StaticError; |
|---|
| 6 | import com.sun.fortress.repository.FortressRepository; |
|---|
| 7 | |
|---|
| 8 | public abstract class Phase { |
|---|
| 9 | |
|---|
| 10 | Phase parentPhase; |
|---|
| 11 | FortressRepository repository; |
|---|
| 12 | GlobalEnvironment env; |
|---|
| 13 | long lastModified; |
|---|
| 14 | AnalyzeResult result; |
|---|
| 15 | |
|---|
| 16 | public Phase(Phase parentPhase){ |
|---|
| 17 | this.parentPhase = parentPhase; |
|---|
| 18 | if (parentPhase != null) { |
|---|
| 19 | repository = parentPhase.getRepository(); |
|---|
| 20 | env = parentPhase.getEnv(); |
|---|
| 21 | lastModified = parentPhase.getLastModified(); |
|---|
| 22 | } |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | public final AnalyzeResult getResult() { return result; } |
|---|
| 26 | |
|---|
| 27 | public final FortressRepository getRepository() { |
|---|
| 28 | return repository; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | public final GlobalEnvironment getEnv() { |
|---|
| 32 | return env; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | public final long getLastModified() { |
|---|
| 36 | return lastModified; |
|---|
| 37 | } |
|---|
| 38 | |
|---|
| 39 | public abstract AnalyzeResult execute() throws StaticError ; |
|---|
| 40 | |
|---|
| 41 | public final AnalyzeResult run() throws StaticError { |
|---|
| 42 | if (parentPhase != null) |
|---|
| 43 | parentPhase.run(); |
|---|
| 44 | result = execute(); |
|---|
| 45 | return result; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | } |
|---|