Changeset 2407

Show
Ignore:
Timestamp:
07/28/08 21:01:19 (16 months ago)
Author:
mspiegel
Message:

[static analysis] replace tab characters with spaces, because tab characters are yucky.

Location:
trunk/ProjectFortress/src/com/sun/fortress/compiler/phases
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/CodeGenerationPhase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    2727 
    2828public class CodeGenerationPhase extends Phase { 
    29          
    30         public CodeGenerationPhase(Phase parentPhase) { 
    31                 super(parentPhase); 
    32         } 
    3329 
    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()); 
     30    public CodeGenerationPhase(Phase parentPhase) { 
     31        super(parentPhase); 
     32    } 
    4133 
    42                 if (!apiGR.isSuccessful()) { 
    43                         throw new MultipleStaticError(apiGR.errors()); 
    44                 } 
     34    @Override 
     35    public AnalyzeResult execute() throws StaticError { 
     36        Debug.debug(Debug.Type.FORTRESS, 1, "Start phase CodeGeneration"); 
     37        AnalyzeResult previous = parentPhase.getResult(); 
    4538 
    46                 // Generate top-level byte code environments for components 
    47                 TopLevelEnvGen.CompilationUnitResult componentGR = TopLevelEnvGen 
    48                                 .generateComponentEnvs(previous.components()); 
     39        TopLevelEnvGen.CompilationUnitResult apiGR = TopLevelEnvGen 
     40                .generateApiEnvs(previous.apis()); 
    4941 
    50                 if (!componentGR.isSuccessful()) { 
    51                         throw new MultipleStaticError(componentGR.errors()); 
    52                 } 
     42        if (!apiGR.isSuccessful()) { 
     43            throw new MultipleStaticError(apiGR.errors()); 
     44        } 
    5345 
    54                 return new AnalyzeResult(previous.apis(), previous.components(),  
    55                                 IterUtil.<StaticError> empty(), previous.typeEnvAtNode());         
    56          
    57         } 
     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    } 
    5858 
    5959} 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/DesugarPhase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    2929 
    3030public class DesugarPhase extends Phase { 
    31      
    32      
    33         public DesugarPhase(Phase parentPhase) { 
    34                 super(parentPhase); 
    35         } 
    3631 
    37         @Override 
    38     public AnalyzeResult execute( ) throws StaticError { 
    39         Debug.debug( Debug.Type.FORTRESS, 1, "Start phase Desugar" ); 
    40                 AnalyzeResult previous = parentPhase.getResult();        
    41          
    42         GlobalEnvironment apiEnv = new GlobalEnvironment.FromMap(CollectUtil.union(repository.apis(), 
    43                                                        previous.apis())); 
     32    public DesugarPhase(Phase parentPhase) { 
     33        super(parentPhase); 
     34    } 
    4435 
    45         Desugarer.ApiResult apiDSR = Desugarer.desugarApis(previous.apis(), apiEnv); 
     36    @Override 
     37    public AnalyzeResult execute() throws StaticError { 
     38        Debug.debug(Debug.Type.FORTRESS, 1, "Start phase Desugar"); 
     39        AnalyzeResult previous = parentPhase.getResult(); 
    4640 
    47         if ( ! apiDSR.isSuccessful() ){ 
    48                 throw new MultipleStaticError(apiDSR.errors()); 
    49         } 
     41        GlobalEnvironment apiEnv = new GlobalEnvironment.FromMap(CollectUtil 
     42                .union(repository.apis(), previous.apis())); 
    5043 
    51         Desugarer.ComponentResult componentDSR = Desugarer.desugarComponents(previous.components(), apiEnv); 
     44        Desugarer.ApiResult apiDSR = Desugarer.desugarApis(previous.apis(), 
     45                apiEnv); 
    5246 
    53         if ( ! componentDSR.isSuccessful() ){ 
    54                 throw new MultipleStaticError(componentDSR.errors()); 
    55         } 
     47        if (!apiDSR.isSuccessful()) { 
     48            throw new MultipleStaticError(apiDSR.errors()); 
     49        } 
    5650 
    57         return new AnalyzeResult(apiDSR.apis(), componentDSR.components(),  
    58                         IterUtil.<StaticError>empty(), previous.typeEnvAtNode()); 
     51        Desugarer.ComponentResult componentDSR = Desugarer.desugarComponents( 
     52                previous.components(), apiEnv); 
     53 
     54        if (!componentDSR.isSuccessful()) { 
     55            throw new MultipleStaticError(componentDSR.errors()); 
     56        } 
     57 
     58        return new AnalyzeResult(apiDSR.apis(), componentDSR.components(), 
     59                IterUtil.<StaticError> empty(), previous.typeEnvAtNode()); 
    5960    } 
    6061 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/DisambiguatePhase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    2929import edu.rice.cs.plt.iter.IterUtil; 
    3030 
    31 public class DisambiguatePhase extends Phase {           
     31public class DisambiguatePhase extends Phase { 
    3232 
    33         public DisambiguatePhase(Phase parentPhase) { 
    34                 super(parentPhase); 
    35         }                
    36          
     33    public DisambiguatePhase(Phase parentPhase) { 
     34        super(parentPhase); 
     35    } 
     36 
    3737    @Override 
    38     public AnalyzeResult execute( ) throws StaticError { 
    39         Debug.debug( Debug.Type.FORTRESS, 1, "Start phase Disambiguate" ); 
    40                 AnalyzeResult previous = parentPhase.getResult();                
     38    public AnalyzeResult execute() throws StaticError { 
     39        Debug.debug(Debug.Type.FORTRESS, 1, "Start phase Disambiguate"); 
     40        AnalyzeResult previous = parentPhase.getResult(); 
    4141 
    42                 // Build a new GlobalEnvironment consisting of all APIs in a global 
    43                 // repository combined with all APIs that have been processed in the previous 
    44                 // step.  For now, we are implementing pure static linking, so there is 
    45                 // no global repository. 
    46                 GlobalEnvironment rawApiEnv = 
    47                         new GlobalEnvironment.FromMap(CollectUtil.union(repository.apis(), 
    48                                         previous.apis())); 
     42        // Build a new GlobalEnvironment consisting of all APIs in a global 
     43        // repository combined with all APIs that have been processed in the 
     44        // previous 
     45        // step. For now, we are implementing pure static linking, so there is 
     46        // no global repository. 
     47        GlobalEnvironment rawApiEnv = new GlobalEnvironment.FromMap(CollectUtil 
     48                .union(repository.apis(), previous.apis())); 
    4949 
    50                 // Rewrite all API ASTs so they include only fully qualified names, relying 
    51                 // on the rawApiEnv constructed in the previous step. Note that, after this 
    52                 // step, the rawApiEnv is stale and needs to be rebuilt with the new API ASTs. 
    53                 Disambiguator.ApiResult apiDR = 
    54                         Disambiguator.disambiguateApis(previous.apiIterator(), rawApiEnv, repository.apis()); 
    55                 if (!apiDR.isSuccessful()) { 
    56                         throw new MultipleStaticError(apiDR.errors()); 
    57                 } 
     50        // Rewrite all API ASTs so they include only fully qualified names, 
     51        // relying 
     52        // on the rawApiEnv constructed in the previous step. Note that, after 
     53        // this 
     54        // step, the rawApiEnv is stale and needs to be rebuilt with the new API 
     55        // ASTs. 
     56        Disambiguator.ApiResult apiDR = Disambiguator.disambiguateApis(previous 
     57                .apiIterator(), rawApiEnv, repository.apis()); 
     58        if (!apiDR.isSuccessful()) { 
     59            throw new MultipleStaticError(apiDR.errors()); 
     60        } 
    5861 
    59                 // Rebuild ApiIndices. 
    60                 IndexBuilder.ApiResult apiIR = 
    61                         IndexBuilder.buildApis(apiDR.apis(), lastModified); 
    62                 if (!apiIR.isSuccessful()) { 
    63                         throw new MultipleStaticError(apiIR.errors()); 
    64                 } 
     62        // Rebuild ApiIndices. 
     63        IndexBuilder.ApiResult apiIR = IndexBuilder.buildApis(apiDR.apis(), 
     64                lastModified); 
     65        if (!apiIR.isSuccessful()) { 
     66            throw new MultipleStaticError(apiIR.errors()); 
     67        } 
    6568 
    66                 // Rebuild GlobalEnvironment. 
    67                 GlobalEnvironment apiEnv = 
    68                         new GlobalEnvironment.FromMap(CollectUtil.union(repository.apis(), 
    69                                         apiIR.apis())); 
     69        // Rebuild GlobalEnvironment. 
     70        GlobalEnvironment apiEnv = new GlobalEnvironment.FromMap(CollectUtil 
     71                .union(repository.apis(), apiIR.apis())); 
    7072 
    71                 Disambiguator.ComponentResult componentDR = 
    72                         Disambiguator.disambiguateComponents(previous.componentIterator(), apiEnv, 
    73                                         previous.components()); 
    74                 if (!componentDR.isSuccessful()) { 
    75                         throw new MultipleStaticError(componentDR.errors()); 
    76                 } 
     73        Disambiguator.ComponentResult componentDR = Disambiguator 
     74                .disambiguateComponents(previous.componentIterator(), apiEnv, 
     75                        previous.components()); 
     76        if (!componentDR.isSuccessful()) { 
     77            throw new MultipleStaticError(componentDR.errors()); 
     78        } 
    7779 
    78                 // Rebuild ComponentIndices. 
    79                 IndexBuilder.ComponentResult componentsDone = 
    80                         IndexBuilder.buildComponents(componentDR.components(), lastModified); 
    81                 if (!componentsDone.isSuccessful()) { 
    82                         throw new MultipleStaticError(componentsDone.errors()); 
    83                 } 
     80        // Rebuild ComponentIndices. 
     81        IndexBuilder.ComponentResult componentsDone = IndexBuilder 
     82                .buildComponents(componentDR.components(), lastModified); 
     83        if (!componentsDone.isSuccessful()) { 
     84            throw new MultipleStaticError(componentsDone.errors()); 
     85        } 
    8486 
    85                 return new AnalyzeResult(apiIR.apis(), componentsDone.components(),  
    86                                 IterUtil.<StaticError>empty(), previous.typeEnvAtNode()); 
    87          
     87        return new AnalyzeResult(apiIR.apis(), componentsDone.components(), 
     88                IterUtil.<StaticError> empty(), previous.typeEnvAtNode()); 
     89 
    8890    } 
    8991 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/EmptyPhase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    3838public class EmptyPhase extends Phase { 
    3939 
    40         private final Iterable<Api> apis; 
    41         private final Iterable<Component> components; 
    42          
    43         public EmptyPhase(FortressRepository repository, GlobalEnvironment env,  
    44                         Iterable<Api> apis, Iterable<Component> components, long lastModified) { 
    45                 super(null);             
    46                 this.repository = repository;            
    47                 this.env = env; 
    48                 this.apis = apis; 
    49                 this.components = components;            
    50                 this.lastModified = lastModified; 
    51         } 
     40    private final Iterable<Api> apis; 
     41    private final Iterable<Component> components; 
    5242 
    53         @Override        
    54     public AnalyzeResult execute( ) throws StaticError { 
    55         Debug.debug( Debug.Type.FORTRESS, 1, "Start phase Empty" ); 
    56         IndexBuilder.ApiResult apiIndex = IndexBuilder.buildApis(apis, lastModified); 
    57         IndexBuilder.ComponentResult componentIndex = IndexBuilder.buildComponents(components, lastModified); 
     43    public EmptyPhase(FortressRepository repository, GlobalEnvironment env, 
     44            Iterable<Api> apis, Iterable<Component> components, 
     45            long lastModified) { 
     46        super(null); 
     47        this.repository = repository; 
     48        this.env = env; 
     49        this.apis = apis; 
     50        this.components = components; 
     51        this.lastModified = lastModified; 
     52    } 
     53 
     54    @Override 
     55    public AnalyzeResult execute() throws StaticError { 
     56        Debug.debug(Debug.Type.FORTRESS, 1, "Start phase Empty"); 
     57        IndexBuilder.ApiResult apiIndex = IndexBuilder.buildApis(apis, 
     58                lastModified); 
     59        IndexBuilder.ComponentResult componentIndex = IndexBuilder 
     60                .buildComponents(components, lastModified); 
    5861        return new AnalyzeResult(apiIndex.apis(), componentIndex.components(), 
    59                         IterUtil.<StaticError>empty(), Option.<Map<Pair<Node,Span>, TypeEnv>>none()); 
     62                IterUtil.<StaticError> empty(), Option 
     63                        .<Map<Pair<Node, Span>, TypeEnv>> none()); 
    6064    } 
    6165 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/GrammarPhase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    3131public class GrammarPhase extends Phase { 
    3232 
    33         public GrammarPhase(Phase parentPhase) { 
    34                 super(parentPhase); 
    35         } 
    36          
    37         @Override 
    38         public AnalyzeResult execute() throws StaticError { 
    39         Debug.debug( Debug.Type.FORTRESS, 1, "Start phase GrammarPhase" );               
    40                 AnalyzeResult previous = parentPhase.getResult();                        
     33    public GrammarPhase(Phase parentPhase) { 
     34        super(parentPhase); 
     35    } 
    4136 
    42                 GlobalEnvironment apiEnv = 
    43                         new GlobalEnvironment.FromMap(CollectUtil.union(repository.apis(), 
    44                                         previous.apis())); 
     37    @Override 
     38    public AnalyzeResult execute() throws StaticError { 
     39        Debug.debug(Debug.Type.FORTRESS, 1, "Start phase GrammarPhase"); 
     40        AnalyzeResult previous = parentPhase.getResult(); 
    4541 
    46                 GrammarRewriter.ApiResult apiID = GrammarRewriter.rewriteApis(previous.apis(), apiEnv); 
    47                 if (!apiID.isSuccessful()) { 
    48                         throw new MultipleStaticError(apiID.errors()); 
    49                 } 
     42        GlobalEnvironment apiEnv = new GlobalEnvironment.FromMap(CollectUtil 
     43                .union(repository.apis(), previous.apis())); 
    5044 
    51                 IndexBuilder.ApiResult apiDone = IndexBuilder.buildApis(apiID.apis(), lastModified); 
    52                 if (!apiDone.isSuccessful()) { 
    53                         throw new MultipleStaticError(apiDone.errors()); 
    54                 } 
     45        GrammarRewriter.ApiResult apiID = GrammarRewriter.rewriteApis(previous 
     46                .apis(), apiEnv); 
     47        if (!apiID.isSuccessful()) { 
     48            throw new MultipleStaticError(apiID.errors()); 
     49        } 
    5550 
    56                 return new AnalyzeResult(apiDone.apis(), previous.components(),  
    57                                 IterUtil.<StaticError>empty(), previous.typeEnvAtNode());         
    58         } 
     51        IndexBuilder.ApiResult apiDone = IndexBuilder.buildApis(apiID.apis(), 
     52                lastModified); 
     53        if (!apiDone.isSuccessful()) { 
     54            throw new MultipleStaticError(apiDone.errors()); 
     55        } 
     56 
     57        return new AnalyzeResult(apiDone.apis(), previous.components(), 
     58                IterUtil.<StaticError> empty(), previous.typeEnvAtNode()); 
     59    } 
    5960 
    6061} 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/Phase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    2323import com.sun.fortress.repository.FortressRepository; 
    2424 
    25 public abstract class Phase {    
    26          
     25public abstract class Phase { 
     26 
    2727    Phase parentPhase; 
    28         FortressRepository repository; 
     28    FortressRepository repository; 
    2929    GlobalEnvironment env; 
    3030    long lastModified; 
    31      
    32     private AnalyzeResult result;     
    33      
    34         public Phase(Phase parentPhase){ 
     31 
     32    private AnalyzeResult result; 
     33 
     34    public Phase(Phase parentPhase) { 
    3535        this.parentPhase = parentPhase; 
    3636        if (parentPhase != null) { 
    37                 repository = parentPhase.getRepository(); 
    38                 env = parentPhase.getEnv(); 
    39                 lastModified = parentPhase.getLastModified(); 
     37            repository = parentPhase.getRepository(); 
     38            env = parentPhase.getEnv(); 
     39            lastModified = parentPhase.getLastModified(); 
    4040        } 
    4141    } 
    4242 
    43     public final AnalyzeResult getResult() { return result; } 
    44      
     43    public final AnalyzeResult getResult() { 
     44        return result; 
     45    } 
     46 
    4547    public final FortressRepository getRepository() { 
    46                 return repository; 
    47         } 
     48        return repository; 
     49    } 
    4850 
    49         public final GlobalEnvironment getEnv() { 
    50                 return env; 
    51         } 
     51    public final GlobalEnvironment getEnv() { 
     52        return env; 
     53    } 
    5254 
    53         public final long getLastModified() { 
    54                 return lastModified; 
    55         } 
    56          
    57     public abstract AnalyzeResult execute() throws StaticError ; 
     55    public final long getLastModified() { 
     56        return lastModified; 
     57    } 
     58 
     59    public abstract AnalyzeResult execute() throws StaticError; 
    5860 
    5961    public final AnalyzeResult run() throws StaticError { 
    60         if (parentPhase != null) 
    61                 parentPhase.run();         
     62        if (parentPhase != null) 
     63            parentPhase.run(); 
    6264        result = execute(); 
    6365        return result; 
    6466    } 
    65          
     67 
    6668} 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/PhaseOrder.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    2626 
    2727public enum PhaseOrder { 
    28         EMPTY("Empty Phase"), 
    29         DISAMBIGUATE("Disambiguation"),  
    30         GRAMMAR("Grammar Rewriting"),    
    31         TYPECHECK("Typechecking"), 
    32         DESUGAR("Desugaring"),   
    33         CODEGEN("Code generation"); 
    34          
    35         private String phaseName; 
     28    EMPTY("Empty Phase"),  
     29    DISAMBIGUATE("Disambiguation"),  
     30    GRAMMAR("Grammar Rewriting"),  
     31    TYPECHECK("Typechecking"),  
     32    DESUGAR("Desugaring"),  
     33    CODEGEN("Code generation"); 
    3634 
    37         PhaseOrder(String phaseName) { 
    38                 this.phaseName = phaseName; 
    39         } 
    40          
    41         public Phase makePhase(FortressRepository repository, GlobalEnvironment env,  
    42                         Iterable<Api> apis, Iterable<Component> components, long lastModified) throws StaticError { 
    43                 Phase empty = new EmptyPhase(repository,env,apis,components,lastModified); 
    44                 switch(this) { 
    45                         case EMPTY: return empty; 
    46                         default: return makePhaseHelper(empty); 
    47                 } 
    48         } 
    49          
    50         private Phase makePhaseHelper(Phase emptyPhase) { 
    51                 switch(this) { 
    52                         case EMPTY: return emptyPhase; 
    53                         case DISAMBIGUATE: return new DisambiguatePhase(EMPTY.makePhaseHelper(emptyPhase)); 
    54                         case GRAMMAR: return new GrammarPhase(DISAMBIGUATE.makePhaseHelper(emptyPhase)); 
    55                         case TYPECHECK: return new TypeCheckPhase(GRAMMAR.makePhaseHelper(emptyPhase)); 
    56                         case DESUGAR: return new DesugarPhase(TYPECHECK.makePhaseHelper(emptyPhase)); 
    57                         case CODEGEN: return new CodeGenerationPhase(DESUGAR.makePhaseHelper(emptyPhase)); 
    58                         default: return InterpreterBug.bug("Unknown static analysis phase: " + phaseName); 
    59                 } 
    60         } 
    61          
    62         @Override 
    63         public String toString() { 
    64                 return phaseName; 
    65         } 
    66                          
     35    private String phaseName; 
     36 
     37    PhaseOrder(String phaseName) { 
     38        this.phaseName = phaseName; 
     39    } 
     40 
     41    public Phase makePhase(FortressRepository repository, 
     42            GlobalEnvironment env, Iterable<Api> apis, 
     43            Iterable<Component> components, long lastModified) 
     44            throws StaticError { 
     45        Phase empty = new EmptyPhase(repository, env, apis, components, 
     46                lastModified); 
     47        switch (this) { 
     48        case EMPTY: 
     49            return empty; 
     50        default: 
     51            return makePhaseHelper(empty); 
     52        } 
     53    } 
     54 
     55    private Phase makePhaseHelper(Phase emptyPhase) { 
     56        switch (this) { 
     57        case EMPTY: 
     58            return emptyPhase; 
     59        case DISAMBIGUATE: 
     60            return new DisambiguatePhase(EMPTY.makePhaseHelper(emptyPhase)); 
     61        case GRAMMAR: 
     62            return new GrammarPhase(DISAMBIGUATE.makePhaseHelper(emptyPhase)); 
     63        case TYPECHECK: 
     64            return new TypeCheckPhase(GRAMMAR.makePhaseHelper(emptyPhase)); 
     65        case DESUGAR: 
     66            return new DesugarPhase(TYPECHECK.makePhaseHelper(emptyPhase)); 
     67        case CODEGEN: 
     68            return new CodeGenerationPhase(DESUGAR.makePhaseHelper(emptyPhase)); 
     69        default: 
     70            return InterpreterBug.bug("Unknown static analysis phase: " 
     71                    + phaseName); 
     72        } 
     73    } 
     74 
     75    @Override 
     76    public String toString() { 
     77        return phaseName; 
     78    } 
     79 
    6780} 
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/phases/TypeCheckPhase.java

    r2406 r2407  
    1414  Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered 
    1515  trademarks of Sun Microsystems, Inc. in the U.S. and other countries. 
    16   ******************************************************************************/ 
     16 ******************************************************************************/ 
    1717 
    1818package com.sun.fortress.compiler.phases; 
     
    3737 
    3838public class TypeCheckPhase extends Phase { 
    39          
     39 
    4040    public TypeCheckPhase(Phase parentPhase) { 
    41                 super(parentPhase); 
    42         } 
     41        super(parentPhase); 
     42    } 
    4343 
    44         @Override 
    45     public AnalyzeResult execute( ) throws StaticError { 
    46         Debug.debug( Debug.Type.FORTRESS, 1, "Start phase TypeCheck" ); 
    47                 AnalyzeResult previous = parentPhase.getResult();        
     44    @Override 
     45    public AnalyzeResult execute() throws StaticError { 
     46        Debug.debug(Debug.Type.FORTRESS, 1, "Start phase TypeCheck"); 
     47        AnalyzeResult previous = parentPhase.getResult(); 
    4848 
    49         IndexBuilder.ApiResult apiIndex = IndexBuilder.buildApis(previous.apiIterator(), lastModified); 
    50         IndexBuilder.ComponentResult componentIndex = IndexBuilder.buildComponents(previous.componentIterator(), lastModified); 
    51         GlobalEnvironment apiEnv = new GlobalEnvironment.FromMap(CollectUtil.union(repository.apis(), 
    52                                                      apiIndex.apis())); 
     49        IndexBuilder.ApiResult apiIndex = IndexBuilder.buildApis(previous 
     50                .apiIterator(), lastModified); 
     51        IndexBuilder.ComponentResult componentIndex = IndexBuilder 
     52                .buildComponents(previous.componentIterator(), lastModified); 
     53        GlobalEnvironment apiEnv = new GlobalEnvironment.FromMap(CollectUtil 
     54                .union(repository.apis(), apiIndex.apis())); 
    5355 
    54         StaticChecker.ApiResult apiSR = StaticChecker.checkApis( apiIndex.apis(), apiEnv ); 
     56        StaticChecker.ApiResult apiSR = StaticChecker.checkApis( 
     57                apiIndex.apis(), apiEnv); 
    5558 
    56         if ( !apiSR.isSuccessful() ){ 
    57                 throw new MultipleStaticError(apiSR.errors()); 
    58         } 
     59        if (!apiSR.isSuccessful()) { 
     60            throw new MultipleStaticError(apiSR.errors()); 
     61        } 
    5962 
    60         StaticChecker.ComponentResult componentSR = 
    61                 StaticChecker.checkComponents( componentIndex.components(), env); 
     63        StaticChecker.ComponentResult componentSR = StaticChecker 
     64                .checkComponents(componentIndex.components(), env); 
    6265 
    63         if ( !componentSR.isSuccessful() ){ 
    64                 throw new MultipleStaticError(componentSR.errors()); 
    65         } 
     66        if (!componentSR.isSuccessful()) { 
     67            throw new MultipleStaticError(componentSR.errors()); 
     68        } 
    6669 
    67         return new AnalyzeResult(apiSR.apis(), componentSR.components(),  
    68                         IterUtil.<StaticError> empty(),  
    69                         Option.<Map<Pair<Node,Span>, TypeEnv>>some(componentSR.typeEnvAtNode())); 
     70        return new AnalyzeResult(apiSR.apis(), componentSR.components(), 
     71                IterUtil.<StaticError> empty(), Option 
     72                        .<Map<Pair<Node, Span>, TypeEnv>> some(componentSR 
     73                                .typeEnvAtNode())); 
    7074    } 
    7175