diff --git a/compiler/2014/Signature.jrag b/compiler/2014/Signature.jrag index adbd0ef617ddbdfd847615842d983a212a647b82..8c50f91a84d11076458ee218d56ad866a464de41 100644 --- a/compiler/2014/Signature.jrag +++ b/compiler/2014/Signature.jrag @@ -23,21 +23,6 @@ aspect SigAnnotations { syn boolean ASTNode.isTypeInstance() = false; eq TypeInstance.isTypeInstance() = true; -} - -aspect Signature { - - syn boolean Decl.isSampleDecl(); - eq TypeDecl.isSampleDecl() = false; - eq SampleDecl.isSampleDecl() = true; - - syn boolean Decl.sendOnlyFlatSignatures(Java_env env) = (env.version==2006); - - eq Decl.getSignature().parentDecl() = this; - eq Signature.getSignatureList().parentDecl() = parentDecl(); - - inh Decl Signature.parentDecl(); - inh Decl SignatureList.parentDecl(); /// TESTING syn String Decl.getAnnotationString() { @@ -52,6 +37,18 @@ aspect Signature { return sb.toString(); } + + syn int TypeInstance.fooHash() { + List<Annotation> ints = getAnnotationList(); + int result=0; + for(Annotation i : ints) { + if(i.isIntention()) { + result += i.toString().hashCode(); + } + } + return result; + } + syn String TypeInstance.getAnnotationString() { StringBuilder sb = new StringBuilder(); List<Annotation> ints = getAnnotationList(); @@ -67,13 +64,29 @@ aspect Signature { public void TypeInstance.debugAnnotations(String context) { if(hasAnnotations()){ - System.out.println(context+".annotations: " + getAnnotationString()); + System.out.println(context+".annotations: " + fooHash() + " : " + getAnnotationString()); } else { - System.out.println(context+": NO ANNOTATIONS "); + System.out.println(context + " : " + fooHash() + " : " + ": NO ANNOTATIONS "); } } // TESTING END +} + +aspect Signature { + + syn boolean Decl.isSampleDecl(); + eq TypeDecl.isSampleDecl() = false; + eq SampleDecl.isSampleDecl() = true; + + syn boolean Decl.sendOnlyFlatSignatures(Java_env env) = (env.version==2006); + + eq Decl.getSignature().parentDecl() = this; + eq Signature.getSignatureList().parentDecl() = parentDecl(); + + inh Decl Signature.parentDecl(); + inh Decl SignatureList.parentDecl(); + syn nta Signature Decl.getSignature() { SignatureList sl = new SignatureList(); genSigLineForDecl(sl, true, this); @@ -217,7 +230,7 @@ aspect Signature { } public void TypeInstance.genSigLineForDecl(SignatureList list, boolean decl, ASTNode inst) { - debugAnnotations(this.getName()); + debugAnnotations(this.getName()); getDataType().genSigLineForDecl(list, decl, this); }