Changeset 2186

Show
Ignore:
Timestamp:
07/05/08 04:00:26 (3 months ago)
Author:
mspiegel
Message:

[environment] added try/catch block to generateApiEnvs and moved writeImportFields() to be called by writeFields().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ProjectFortress/src/com/sun/fortress/compiler/environments/TopLevelEnvGen.java

    r2185 r2186  
    159159            String className = NodeUtil.nameString(apiName); 
    160160            className = className + API_ENV_SUFFIX; 
    161  
    162             byte[] envClass = generateForCompilationUnit(className, apis.get(apiName), env); 
    163             compiledApis.put(apiName, envClass); 
     161             
     162            try { 
     163                byte[] envClass = generateForCompilationUnit(className, apis.get(apiName), env); 
     164                compiledApis.put(apiName, envClass); 
     165            } catch(StaticError staticError) { 
     166                errors.add(staticError); 
     167            }                                    
    164168        } 
    165169 
     
    231235        Relation<String, Integer> apiEnvHashCode = new IndexedRelation<String,Integer>(); 
    232236 
    233         writeImportFields(cw, compUnitIndex, apiEnvHashCode); 
    234         writeFields(cw, compUnitIndex, fValueHashCode, fTypeHashCode); 
     237        writeFields(cw, compUnitIndex, fValueHashCode, fTypeHashCode, apiEnvHashCode); 
    235238        writeMethodInit(cw, className); 
    236239 
     
    249252    } 
    250253 
     254    /** 
     255     * Write the import statments as fields in this compiled environment. 
     256     * This method will be invoked by writeFields(). 
     257     */ 
    251258    private static void writeImportFields(ClassWriter cw, CompilationUnitIndex compUnitIndex, 
    252259                                                      Relation<String,Integer> apiEnvHashCode) { 
     
    276283        } 
    277284 
     285    /** 
     286     * Write all the fields that will be used in this compiled environment 
     287     */ 
    278288        private static void writeFields(ClassWriter cw, CompilationUnitIndex compUnitIndex, 
    279289            Relation<String, Integer> fValueHashCode, 
    280             Relation<String, Integer> fTypeHashCode) { 
     290            Relation<String, Integer> fTypeHashCode, 
     291            Relation<String, Integer> apiEnvHashCode) { 
    281292 
    282293        // Create all variables as fields in the environment 
     
    303314            cw.visitField(Opcodes.ACC_PUBLIC, mangleIdentifier(idString), EnvironmentClasses.FTYPE.descriptor(), null, null).visitEnd(); 
    304315        } 
     316         
     317        writeImportFields(cw, compUnitIndex, apiEnvHashCode); 
    305318    } 
    306319