]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/header/ModuleHeader.java
(refs #6923) Explicit export annotation for SCL modules
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / internal / header / ModuleHeader.java
index c408b4bb6e12f01a3fe33610a072055692b958c6..33a88ffba83dee70893e841c6cb516407ebca6fb 100644 (file)
@@ -1,5 +1,8 @@
 package org.simantics.scl.compiler.internal.header;
 
 package org.simantics.scl.compiler.internal.header;
 
+import java.util.List;
+
+import org.simantics.scl.compiler.elaboration.expressions.EVar;
 import org.simantics.scl.compiler.elaboration.expressions.annotations.AnnotationUtils;
 import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment;
 import org.simantics.scl.compiler.errors.ErrorLog;
 import org.simantics.scl.compiler.elaboration.expressions.annotations.AnnotationUtils;
 import org.simantics.scl.compiler.elaboration.expressions.records.FieldAssignment;
 import org.simantics.scl.compiler.errors.ErrorLog;
@@ -10,6 +13,7 @@ public class ModuleHeader {
     public long classLoaderLocation;
     public String defaultLocalName;
     public boolean fields;
     public long classLoaderLocation;
     public String defaultLocalName;
     public boolean fields;
+    public List<EVar> export;
     
     private void read(ErrorLog errorLog, DModuleHeader header) {
         for(FieldAssignment assignment : header.fields)
     
     private void read(ErrorLog errorLog, DModuleHeader header) {
         for(FieldAssignment assignment : header.fields)
@@ -25,6 +29,15 @@ public class ModuleHeader {
                         classLoaderLocation = assignment.location;
                 }
                 break;
                         classLoaderLocation = assignment.location;
                 }
                 break;
+            case "export":
+                if(assignment.value == null)
+                    errorLog.log(assignment.location, "Property export needs to be given a string list value.");
+                else {
+                    export = AnnotationUtils.extractIdentifierList(assignment.value);
+                    if(export == null)
+                        errorLog.log(assignment.value.location, "Expected a list of exported items.");
+                }
+                break;
             case "defaultLocalName":
                if(assignment.value == null)
                     errorLog.log(assignment.location, "Property defaultLocalName needs to be given a string value.");
             case "defaultLocalName":
                if(assignment.value == null)
                     errorLog.log(assignment.location, "Property defaultLocalName needs to be given a string value.");
@@ -35,6 +48,8 @@ public class ModuleHeader {
                }
                break;
             case "fields":
                }
                break;
             case "fields":
+                if(assignment.value != null)
+                    errorLog.log(assignment.location, "No value expected for property fields.");
                 this.fields = true;
                 break;
             default:
                 this.fields = true;
                 break;
             default: