ArrayList<StandardTypeConstructor> dataTypes = new ArrayList<StandardTypeConstructor>();
THashMap<String, ClassRef> classRefs = new THashMap<String, ClassRef>();
THashMap<String, BranchPoint[]> branchPoints;
+
+ THashMap<String, EVar> exportMap = null;
public Elaboration(CompilationContext compilationContext, CompilationTimer timer, EnvironmentFactory localEnvironmentFactory,
String moduleName, ModuleHeader moduleHeader, ArrayList<ImportDeclaration> importsAst,
isPrivate = true;
}
}
+ if(exportMap != null)
+ isPrivate = exportMap.remove(name) == null;
Type type = createTypeTranslationContext().toType(javaMethod.type);
typeMap.put(name.name, valueTypeAst);
}
- THashMap<String, EVar> exportMap = null;
- if(moduleHeader != null && moduleHeader.export != null) {
- exportMap = new THashMap<String, EVar>();
- for(EVar export : moduleHeader.export)
- if(exportMap.put(export.name, export) != null)
- errorLog.log(export.location, "The symbol " + export.name + " is exported multiple times.");
- }
-
for(String name : valueDefinitionsAst.getValueNames()) {
ArrayList<DValueAst> defs = valueDefinitionsAst.getDefinition(name);
if(defs.size() != 1 || !(defs.get(0).value instanceof EPreCHRRulesetConstructor))
throw e;
}
}
- if(exportMap != null)
- for(EVar export : exportMap.values())
- errorLog.log(export.location, "The symbol " + export.name + " is not defined in the module.");
for(String name : relationDefinitionsAst.getRelationNames()) {
ArrayList<DRelationAst> definitions = relationDefinitionsAst.getDefinition(name);
if(definitions.size() > 1) {
public void collectDebugInfo() {
module.moduleDebugInfo = compilationContext.moduleDebugInfo = new ModuleDebugInfo();
}
+
+ public void prepareExports() {
+ if(moduleHeader != null && moduleHeader.export != null) {
+ exportMap = new THashMap<String, EVar>();
+ for(EVar export : moduleHeader.export)
+ if(exportMap.put(export.name, export) != null)
+ errorLog.log(export.location, "The symbol " + export.name + " is exported multiple times.");
+ }
+ }
+
+ public void checkExports() {
+ if(exportMap != null)
+ for(EVar export : exportMap.values())
+ errorLog.log(export.location, "The symbol " + export.name + " is not defined in the module.");
+ }
}
elaboration.collectDebugInfo();
// Elaboration
if(hasErrors()) return;
+ elaboration.prepareExports();
+ if(hasErrors()) return;
elaboration.addTypesToEnvironment(
declarations.dataTypesAst,
declarations.typeAliasesAst,
elaboration.addValueDefinitionsToEnvironment(declarations.typeAnnotationsAst);
elaboration.processRules(declarations.rulesAst);
elaboration.addSupplementedTypeAnnotationsToEnvironment();
+ elaboration.checkExports();
if(SCLCompilerConfiguration.ENABLE_TIMING) phaseFinished("Elaboration");
// Type checking