1 package org.simantics.scl.compiler.internal.header;
3 import org.simantics.scl.compiler.elaboration.expressions.annotations.AnnotationUtils;
4 import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment;
5 import org.simantics.scl.compiler.errors.ErrorLog;
6 import org.simantics.scl.compiler.internal.parsing.declarations.DModuleHeader;
8 public class ModuleHeader {
9 public String classLoader;
10 public long classLoaderLocation;
11 public String defaultLocalName;
13 private void read(ErrorLog errorLog, DModuleHeader header) {
14 for(FieldAssignment assignment : header.fields)
15 switch(assignment.name) {
17 if(assignment.value == null)
18 errorLog.log(assignment.location, "Property classLoader needs to be given a string value.");
20 classLoader = AnnotationUtils.extractString(assignment.value);
21 if(classLoader == null)
22 errorLog.log(assignment.value.location, "Expected bundle name here.");
24 classLoaderLocation = assignment.location;
27 case "defaultLocalName":
28 if(assignment.value == null)
29 errorLog.log(assignment.location, "Property defaultLocalName needs to be given a string value.");
31 defaultLocalName = AnnotationUtils.extractString(assignment.value);
32 if(defaultLocalName == null)
33 errorLog.log(assignment.value.location, "Expected string here.");
37 errorLog.logWarning(assignment.location, "Unknown module header field was skipped.");
41 public static ModuleHeader process(ErrorLog errorLog, DModuleHeader header) {
44 ModuleHeader result = new ModuleHeader();
45 result.read(errorLog, header);