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

Revision 2406, 2.0 KB (checked in by mspiegel, 16 months ago)

Added copyright notices.

Line 
1/*******************************************************************************
2  Copyright 2008 Sun Microsystems, Inc.,
3  4150 Network Circle, Santa Clara, California 95054, U.S.A.
4  All rights reserved.
5
6  U.S. Government Rights - Commercial software.
7  Government users are subject to the Sun Microsystems, Inc. standard
8  license agreement and applicable provisions of the FAR and its supplements.
9
10  Use is subject to license terms.
11
12  This distribution may include materials developed by third parties.
13
14  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered
15  trademarks of Sun Microsystems, Inc. in the U.S. and other countries.
16  ******************************************************************************/
17
18package com.sun.fortress.compiler.phases;
19
20import com.sun.fortress.compiler.AnalyzeResult;
21import com.sun.fortress.compiler.environments.TopLevelEnvGen;
22import com.sun.fortress.exceptions.MultipleStaticError;
23import com.sun.fortress.exceptions.StaticError;
24import com.sun.fortress.useful.Debug;
25
26import edu.rice.cs.plt.iter.IterUtil;
27
28public class CodeGenerationPhase extends Phase {
29       
30        public CodeGenerationPhase(Phase parentPhase) {
31                super(parentPhase);
32        }
33
34        @Override
35        public AnalyzeResult execute() throws StaticError {             
36        Debug.debug( Debug.Type.FORTRESS, 1, "Start phase CodeGeneration" );
37                AnalyzeResult previous = parentPhase.getResult();
38               
39                TopLevelEnvGen.CompilationUnitResult apiGR = TopLevelEnvGen
40                                .generateApiEnvs(previous.apis());
41
42                if (!apiGR.isSuccessful()) {
43                        throw new MultipleStaticError(apiGR.errors());
44                }
45
46                // Generate top-level byte code environments for components
47                TopLevelEnvGen.CompilationUnitResult componentGR = TopLevelEnvGen
48                                .generateComponentEnvs(previous.components());
49
50                if (!componentGR.isSuccessful()) {
51                        throw new MultipleStaticError(componentGR.errors());
52                }
53
54                return new AnalyzeResult(previous.apis(), previous.components(),
55                                IterUtil.<StaticError> empty(), previous.typeEnvAtNode());       
56       
57        }
58
59}
Note: See TracBrowser for help on using the browser.