X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Finternal%2Fheader%2FModuleHeader.java;h=80acf17c571cb242e2db401233525006f118908d;hb=bf5f7cda1b9b64484cc6e53499e38d6785744aec;hp=c408b4bb6e12f01a3fe33610a072055692b958c6;hpb=27d76db8786149c91b2e5a97d79c774e8c163eb0;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/header/ModuleHeader.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/header/ModuleHeader.java index c408b4bb6..80acf17c5 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/header/ModuleHeader.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/header/ModuleHeader.java @@ -1,18 +1,23 @@ 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.internal.parsing.declarations.DModuleHeader; public class ModuleHeader { public String classLoader; public long classLoaderLocation; public String defaultLocalName; + public List export; + // Features + public boolean chr; public boolean fields; - private void read(ErrorLog errorLog, DModuleHeader header) { - for(FieldAssignment assignment : header.fields) + private void read(ErrorLog errorLog, FieldAssignment[] fields) { + for(FieldAssignment assignment : fields) switch(assignment.name) { case "bundle": if(assignment.value == null) @@ -25,6 +30,15 @@ public class ModuleHeader { 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."); @@ -35,18 +49,25 @@ public class ModuleHeader { } break; case "fields": + if(assignment.value != null) + errorLog.log(assignment.location, "No value expected for property fields."); this.fields = true; break; + case "chr": + if(assignment.value != null) + errorLog.log(assignment.location, "No value expected for property chr."); + this.chr = true; + break; default: errorLog.logWarning(assignment.location, "Unknown module header field was skipped."); } } - public static ModuleHeader process(ErrorLog errorLog, DModuleHeader header) { - if(header == null) + public static ModuleHeader process(ErrorLog errorLog, FieldAssignment[] fields) { + if(fields == null) return null; ModuleHeader result = new ModuleHeader(); - result.read(errorLog, header); + result.read(errorLog, fields); return result; } }