import org.simantics.scl.compiler.elaboration.java.JavaMethodDeclaration;
import org.simantics.scl.compiler.elaboration.macros.StandardMacroRule;
import org.simantics.scl.compiler.elaboration.modules.DeprecatedProperty;
+import org.simantics.scl.compiler.elaboration.modules.DerivedProperty;
import org.simantics.scl.compiler.elaboration.modules.InlineProperty;
import org.simantics.scl.compiler.elaboration.modules.MethodImplementation;
import org.simantics.scl.compiler.elaboration.modules.PrivateProperty;
String fullName = instancePrefix + valueName;
long loc = valueDefs.getDefinition(valueName).get(0).location;
valueDefinitionsAst.addFrom(valueDefs, valueName, fullName);
+ valueDefinitionsAst.setDerived(fullName);
/*valueDefinitionsAst.addAnnotation(fullName, new DAnnotationAst(new EVar("@private"),
Collections.<Expression>emptyList()));*/
TypeClassMethod method = typeClass.methods.get(valueName);
constructor.getParameterTypes());
if(dataType.constructors.length == 1 && (
dataType.getTypeDesc() == null ||
- dataType.constructors[0].javaName.equals(MethodBuilderBase.getClassName(dataType.getTypeDesc()))))
+ (dataType.constructors[0].javaName != null &&
+ dataType.constructors[0].javaName.equals(MethodBuilderBase.getClassName(dataType.getTypeDesc())))))
sclConstructor.setOnlyConstructor(true);
value.setValue(sclConstructor);
value.setType(constructor.getType());
value.definitionLocation = location;
if(module.addValue(value))
errorLog.log(location, "Value " + name + " is already defined.");
+ if(valueDefinitionsAst.isDerived(name))
+ value.addProperty(DerivedProperty.INSTANCE);
}
for(DValueTypeAst valueTypeAst : typeAnnotationsAst)
for(EVar name : valueTypeAst.names) {
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);
try {
for(DAnnotationAst annotation : annotations) {
handleAnnotation(value, defs, annotation);
}
+ if(exportMap != null && exportMap.remove(name) == null)
+ value.addProperty(PrivateProperty.INSTANCE);
} catch(RuntimeException e) {
errorLog.setExceptionPosition(defs.get(0).location);
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) {
}
}
else if(annotation.id.text.equals("@private")) {
+ if(moduleHeader != null && moduleHeader.export != null)
+ errorLog.log(annotation.location, "Annotation @private is not used when module header contains export property.");
value.addProperty(PrivateProperty.INSTANCE);
}
else if(annotation.id.text.equals("@deprecated")) {