- errorLog.log(effect.location, "Type "+effect.name+" has already been defined in this module.");
- }
- javaTypeTranslator = new JavaTypeTranslator(environment);
+ errorLog.log(effect.location, "Effect "+effect.name+" has already been defined in this module.");
+ }
+ for(DRulesetAst ruleset : rulesetsAst) {
+ ruleset.type = Types.con(moduleName, ruleset.name);
+ ruleset.className = compilationContext.namingPolicy.getDataTypeClassName(ruleset.name);
+ StandardTypeConstructor typeConstructor = new StandardTypeConstructor(ruleset.type, Kinds.STAR,
+ TypeDesc.forClass(ruleset.className), ruleset.documentation == null ? null : ruleset.documentation.documentation);
+ typeConstructor.external = true;
+ addTypeDescriptor(ruleset.location, ruleset.name, typeConstructor);
+ }
+ javaTypeTranslator = new JavaTypeTranslator(compilationContext.environment);
+ compilationContext.javaTypeTranslator = javaTypeTranslator;
+ }
+
+ private void addTypeDescriptor(long location, String name, TypeDescriptor typeDescriptor) {
+ if(module.addTypeDescriptor(name, typeDescriptor))
+ errorLog.log(location, "Type "+name+" has already been defined in this module.");