Skip to main content
Sign in
Snippets Groups Projects
Commit a1a16851 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

WiP: generating intentions in signatures.

parent a0bc4617
Branches
No related tags found
No related merge requests found
aspect Annotations {
syn boolean TypeInstance.hasAnnotations() = getNumAnnotation()>0;
syn boolean TypeInstance.hasIntentions() = ! intentions().isEmpty();
syn boolean Annotation.isIntention() = false;
eq Intention.isIntention() = true;
inh TypeInstance Annotation.parentInstance();
eq TypeInstance.getAnnotation(int i).parentInstance() = this;
coll Set<Intention> TypeInstance.intentions() [new HashSet<Intention>()] with add;
Intention contributes this
to TypeInstance.intentions()
for parentInstance();
}
......@@ -14,17 +14,23 @@ aspect FlatSignature {
}
public void TypeDecl.flatSignature(SignatureList list) {
getDataType().flatSignature(list);
getTypeInstance().flatSignature(list);
}
public void SampleDecl.flatSignature(SignatureList list) {
getDataType().flatSignature(list);
getTypeInstance().flatSignature(list);
}
// public void SampleRefType.flatSignature(SignatureList list) {
// list.addInt(LABCOMM_SAMPLE_REF, "sample");
// }
public void TypeInstance.flatSignature(SignatureList list) {
debugAnnotations(this.getName());
list.addString(getIntentionString(), "intentions: "+getIntentionString());
getDataType().flatSignature(list);
}
public void VoidType.flatSignature(SignatureList list) {
list.addInt(LABCOMM_STRUCT, "void");
list.addInt(0, null);
......@@ -62,6 +68,7 @@ aspect FlatSignature {
}
public void Field.flatSignature(SignatureList list) {
list.addString(getIntentionString(), "intentions: "+getIntentionString());
list.addString(getName(), signatureComment());
getDataType().flatSignature(list);
}
......
......
......@@ -229,8 +229,20 @@ aspect Signature {
" not declared");
}
syn String ASTNode.getIntentionString() = "";
eq TypeInstance.getIntentionString() {
StringBuilder sb = new StringBuilder();
Iterator<Intention> it = intentions().iterator();
while(it.hasNext()) {
Intention i = it.next();
sb.append(i.toString());
}
return sb.toString();
}
public void TypeInstance.genSigLineForDecl(SignatureList list, boolean decl, ASTNode inst) {
debugAnnotations(this.getName());
// debugAnnotations(this.getName());
// list.addString(inst.getIntentionString(), "intention string");
getDataType().genSigLineForDecl(list, decl, this);
}
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment