X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fcompilation%2FElaboration.java;h=abdabf5ac7e3cc55b0fb875e71dfc038d1a1f9b5;hp=ee21ef641a645ea5eae7096f62ece738fa6957fb;hb=7fa60c7f3e3a98026b4657afec5f6c02ed958657;hpb=cc6b8536efa68fe125077ca938b3a20da39f67fd diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java index ee21ef641..abdabf5ac 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/compilation/Elaboration.java @@ -150,6 +150,8 @@ public class Elaboration { ArrayList dataTypes = new ArrayList(); THashMap classRefs = new THashMap(); THashMap branchPoints; + + THashMap exportMap = null; public Elaboration(CompilationContext compilationContext, CompilationTimer timer, EnvironmentFactory localEnvironmentFactory, String moduleName, ModuleHeader moduleHeader, ArrayList importsAst, @@ -713,6 +715,8 @@ public class Elaboration { isPrivate = true; } } + if(exportMap != null) + isPrivate = exportMap.remove(name) == null; Type type = createTypeTranslationContext().toType(javaMethod.type); @@ -1216,14 +1220,6 @@ public class Elaboration { typeMap.put(name.name, valueTypeAst); } - THashMap exportMap = null; - if(moduleHeader != null && moduleHeader.export != null) { - exportMap = new THashMap(); - 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 defs = valueDefinitionsAst.getDefinition(name); if(defs.size() != 1 || !(defs.get(0).value instanceof EPreCHRRulesetConstructor)) @@ -1267,9 +1263,6 @@ public class Elaboration { 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 definitions = relationDefinitionsAst.getDefinition(name); if(definitions.size() > 1) { @@ -1373,4 +1366,19 @@ public class Elaboration { public void collectDebugInfo() { module.moduleDebugInfo = compilationContext.moduleDebugInfo = new ModuleDebugInfo(); } + + public void prepareExports() { + if(moduleHeader != null && moduleHeader.export != null) { + exportMap = new THashMap(); + 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."); + } }