import org.simantics.scl.compiler.module.ImportDeclaration;
import org.simantics.scl.compiler.module.InvalidModulePathException;
import org.simantics.scl.compiler.module.ModuleUtils;
+import org.simantics.scl.compiler.module.debug.ModuleDebugInfo;
import org.simantics.scl.compiler.module.repository.ImportFailure;
import org.simantics.scl.compiler.module.repository.ImportFailureException;
+import org.simantics.scl.compiler.top.SCLCompilerConfiguration;
import org.simantics.scl.compiler.types.TCon;
import org.simantics.scl.compiler.types.TForAll;
import org.simantics.scl.compiler.types.TFun;
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);
final THashMap<SectionName, Query[]> sections = new THashMap<SectionName, Query[]>();
- final TranslationContext context = createTranslationContext();
+ final TranslationContext context = createTranslationContext(ruleName);
if(length > 0) {
THashMap<String, Variable> variables = context.getVariables();
for(TransformationRule extendsRule : extendsRules) {
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))
continue;
try {
SCLValue value = module.getValue(name);
- TranslationContext context = createTranslationContext();
+ TranslationContext context = createTranslationContext(name);
Expression expression = context.translateCases2(defs);
value.setExpression(expression);
continue;
try {
SCLValue value = module.getValue(name);
- TranslationContext context = createTranslationContext();
+ TranslationContext context = createTranslationContext(name);
Expression expression = context.translateCases2(defs);
value.setExpression(expression);
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) {
DRelationAst definition = definitions.get(0);
ConcreteRelation relation = (ConcreteRelation)module.getRelation(name);
relation.location = definition.location;
- TranslationContext context = createTranslationContext();
+ TranslationContext context = createTranslationContext(name);
definition.translateTo(context, relation);
}
}
- private TranslationContext createTranslationContext() {
- return new TranslationContext(compilationContext, null);
+ private TranslationContext createTranslationContext(String definitionName) {
+ return new TranslationContext(compilationContext, null, definitionName);
}
private void handleAnnotation(SCLValue value, ArrayList<DValueAst> defs, DAnnotationAst annotation) {
branchPoints.put(valueName, injector.getAndClearBranchPoints());
}
}
+
+ 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.");
+ }
}