diff --git a/compiler/2014/Annotations.jrag b/compiler/2014/Annotations.jrag index 2472bce08d05cf106e9e707ab939a6829a6caffb..5141043fb2cf40507c5d3fdfd012a6a852f50f97 100644 --- a/compiler/2014/Annotations.jrag +++ b/compiler/2014/Annotations.jrag @@ -1,6 +1,6 @@ aspect Annotations { syn boolean TypeInstance.hasAnnotations() = getNumAnnotation()>0; - syn boolean TypeInstance.hasIntentions() = ! intentions().isEmpty(); + syn boolean TypeInstance.hasIntentions() = ! intentionSet().isEmpty(); syn boolean Annotation.isIntention() = false; eq Intention.isIntention() = true; @@ -9,9 +9,9 @@ aspect Annotations { eq TypeInstance.getAnnotation(int i).parentInstance() = this; - coll Set<Intention> TypeInstance.intentions() [new HashSet<Intention>()] with add; + coll Set<Intention> TypeInstance.intentionSet() [new HashSet<Intention>()] with add; Intention contributes this - to TypeInstance.intentions() + to TypeInstance.intentionSet() for parentInstance(); } diff --git a/compiler/2014/FlatSignature.jrag b/compiler/2014/FlatSignature.jrag index 350b224899f1da5f93d31214c4989bc66714ed56..c3f92b3b8858748ec7e030a6a29380f5424cfb9e 100644 --- a/compiler/2014/FlatSignature.jrag +++ b/compiler/2014/FlatSignature.jrag @@ -35,7 +35,7 @@ aspect FlatSignature { public void TypeInstance.flatSignature(SignatureList list) { if(addIntentions()) { debugAnnotations(this.getName()+".TypeInstance.flatSignature"); - list.addString(getIntentionString(), "intentions: "+getIntentionString()); + list.addIntentions(intentions(), "intentions: "+getIntentionString()); } getDataType().flatSignature(list); } @@ -78,7 +78,7 @@ aspect FlatSignature { public void Field.flatSignature(SignatureList list) { debugAnnotations(this.getName()+".Field.flatSignature"); - list.addString(getIntentionString(), "intentions: "+getIntentionString()); + list.addIntentions(intentions(), "Field: "+getIntentionString()); list.addString(getName(), signatureComment()); getDataType().flatSignature(list); } diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast index 361ca89114016cb294fb99293790d9c371fc797a..d76868cfbf0dbc65eabc088528d7b96f7fa66d52 100644 --- a/compiler/2014/LabComm.ast +++ b/compiler/2014/LabComm.ast @@ -22,6 +22,7 @@ abstract DataSignatureLine : SignatureLine; ByteArraySignatureLine : DataSignatureLine ::= <Data:byte[]>; IntSignatureLine : DataSignatureLine ::= <Data:int>; StringSignatureLine : DataSignatureLine ::= <Data:String>; +IntentionSignatureLine : DataSignatureLine ::= <Data:java.util.Map> ; TypeRefSignatureLine : SignatureLine ::= Decl; Field : TypeInstance; diff --git a/compiler/2014/Signature.jrag b/compiler/2014/Signature.jrag index 30aad01017cd072fbeb710e35785f374872da006..c996f9c272192c464d0d03ad58b13e4a39c3e885 100644 --- a/compiler/2014/Signature.jrag +++ b/compiler/2014/Signature.jrag @@ -172,6 +172,10 @@ aspect Signature { return getIntBytes(getData(), version); } + public void SignatureList.addIntentions(Set<Intention> data, String comment) { + addString(TypeInstance.getIntentionString(data), comment); + } + public void SignatureList.addString(String data, String comment) { addSignatureLine(new StringSignatureLine(indent, comment, data)); } @@ -229,10 +233,15 @@ aspect Signature { " not declared"); } - syn String ASTNode.getIntentionString() = ""; - eq TypeInstance.getIntentionString() { + public String TypeInstance.getIntentionString() { + return getIntentionString(intentions()); + } + + public static String TypeInstance.getIntentionString(Set<Intention> intentions) { + if(intentions==null) return ""; + StringBuilder sb = new StringBuilder(); - Iterator<Intention> it = intentions().iterator(); + Iterator<Intention> it = intentions.iterator(); while(it.hasNext()) { Intention i = it.next(); sb.append(i.toString()); @@ -240,6 +249,17 @@ aspect Signature { return sb.toString(); } + + syn Set<Intention> Specification.emptyIntentions() = new HashSet<Intention>(); + + inh Set<Intention> ASTNode.noIntentions(); + eq Specification.getChild(int i).noIntentions() = emptyIntentions(); + + syn Set<Intention> ASTNode.intentions(); + + eq ASTNode.intentions() = noIntentions(); + eq TypeInstance.intentions() = intentionSet(); + public void TypeInstance.genSigLineForDecl(SignatureList list, boolean decl, ASTNode inst) { // debugAnnotations(this.getName()); // list.addString(inst.getIntentionString(), "intention string");