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();
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)
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.");
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();
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.");
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();
+ 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<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();