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=f7f745841460bdbfc30aacbd0a35b5174620208f;hp=ff5ee3b2902fa0384258f246776d534dbed0d617;hb=4e753de3df98d5411f8329205c0e03f2e13e3c1d;hpb=6f11a60dee43d620d500c0cf5af34a1d91c80a8b 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 ff5ee3b29..f7f745841 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 @@ -169,12 +169,17 @@ public class Elaboration { module = new ConcreteModule(moduleName); compilationContext.module = module; - if(moduleHeader != null && moduleHeader.defaultLocalName != null) - module.setDefaultLocalName(moduleHeader.defaultLocalName); + if(moduleHeader != null) { + if(moduleHeader.defaultLocalName != null) + module.setDefaultLocalName(moduleHeader.defaultLocalName); + if(moduleHeader.deprecated != null) + module.setDeprecation(moduleHeader.deprecated); + } try { if(timer != null) timer.suspendTimer(); importedEnvironment = localEnvironmentFactory.createEnvironment( + compilationContext, importsAst.toArray(new ImportDeclaration[importsAst.size()])); if(timer != null) timer.continueTimer(); @@ -712,7 +717,7 @@ public class Elaboration { type); if(callJava != null) { NameExistenceChecks.checkIfValueExists(errorLog, javaMethod.location, - importedEnvironment, name); + importedEnvironment, module, name); SCLValue value = module.addValue(name, callJava); value.definitionLocation = javaMethod.methodName.location; if(isPrivate) @@ -1137,7 +1142,7 @@ public class Elaboration { value.setType(constructor.getType()); NameExistenceChecks.checkIfValueExists(errorLog, constructor.loc, - importedEnvironment, constructor.name.name); + importedEnvironment, module, constructor.name.name); if(module.addValue(value)) { errorLog.log(constructor.loc, "Value " + constructor.name.name + " is already defined."); @@ -1152,7 +1157,7 @@ public class Elaboration { SCLValue value = method.createValue(); value.definitionLocation = method.location; NameExistenceChecks.checkIfValueExists(errorLog, Locations.NO_LOCATION, - importedEnvironment, value.getName().name); + importedEnvironment, module, value.getName().name); if(module.addValue(value)) { String name = method.getName(); @@ -1172,7 +1177,7 @@ public class Elaboration { long location = valueDefinitionsAst.getLocation(name); NameExistenceChecks.checkIfValueExists(errorLog, location, - importedEnvironment, value.getName().name); + importedEnvironment, module, value.getName().name); value.definitionLocation = location; if(module.addValue(value)) errorLog.log(location, "Value " + name + " is already defined."); @@ -1215,6 +1220,25 @@ public class Elaboration { for(String name : valueDefinitionsAst.getValueNames()) { ArrayList defs = valueDefinitionsAst.getDefinition(name); + if(defs.size() != 1 || !(defs.get(0).value instanceof EPreCHRRulesetConstructor)) + continue; + try { + SCLValue value = module.getValue(name); + TranslationContext context = createTranslationContext(); + Expression expression = context.translateCases2(defs); + value.setExpression(expression); + + if(exportMap != null && exportMap.remove(name) == null) + value.addProperty(PrivateProperty.INSTANCE); + } catch(RuntimeException e) { + errorLog.setExceptionPosition(defs.get(0).location); + throw e; + } + } + for(String name : valueDefinitionsAst.getValueNames()) { + ArrayList defs = valueDefinitionsAst.getDefinition(name); + if(defs.size() == 1 && defs.get(0).value instanceof EPreCHRRulesetConstructor) + continue; try { SCLValue value = module.getValue(name); TranslationContext context = createTranslationContext();