root/trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/CodeGenerationPhase.java @ 2404

Revision 2404, 1.3 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 
1package com.sun.fortress.compiler.phases;
2
3import com.sun.fortress.compiler.AnalyzeResult;
4import com.sun.fortress.compiler.environments.TopLevelEnvGen;
5import com.sun.fortress.exceptions.MultipleStaticError;
6import com.sun.fortress.exceptions.StaticError;
7import com.sun.fortress.useful.Debug;
8
9import edu.rice.cs.plt.iter.IterUtil;
10
11public class CodeGenerationPhase extends Phase {
12       
13        public CodeGenerationPhase(Phase parentPhase) {
14                super(parentPhase);
15        }
16
17        @Override
18        public AnalyzeResult execute() throws StaticError {             
19        Debug.debug( Debug.Type.FORTRESS, 1, "Start phase CodeGeneration" );
20                AnalyzeResult previous = parentPhase.getResult();
21               
22                TopLevelEnvGen.CompilationUnitResult apiGR = TopLevelEnvGen
23                                .generateApiEnvs(previous.apis());
24
25                if (!apiGR.isSuccessful()) {
26                        throw new MultipleStaticError(apiGR.errors());
27                }
28
29                // Generate top-level byte code environments for components
30                TopLevelEnvGen.CompilationUnitResult componentGR = TopLevelEnvGen
31                                .generateComponentEnvs(previous.components());
32
33                if (!componentGR.isSuccessful()) {
34                        throw new MultipleStaticError(componentGR.errors());
35                }
36
37                return new AnalyzeResult(previous.apis(), previous.components(),
38                                IterUtil.<StaticError> empty(), previous.typeEnvAtNode());       
39       
40        }
41
42}
Note: See TracBrowser for help on using the browser.