From d019bc58232c8bda91e20a95bd5bc3362bdafbab Mon Sep 17 00:00:00 2001
From: Sven Gestegard Robertz <sven.robertz@cs.lth.se>
Date: Thu, 21 May 2015 11:54:49 +0200
Subject: [PATCH] Annotations are for the use of a data type, so *Decl should
 not have annotations

This reverts commit 15a836393047593d994a9b1d5e2326c436907bd7.

Conflicts:
	compiler/2014/Annotations.jrag
	compiler/2014/LabComm.ast
	compiler/2014/Refactoring.jrag
---
 compiler/2014/Annotations.jrag     |  8 ++++----
 compiler/2014/LabComm.ast          |  5 ++---
 compiler/2014/LabCommParser.parser |  4 ++--
 compiler/2014/Refactoring.jrag     | 26 --------------------------
 examples/user_types/test.lc        |  2 +-
 5 files changed, 9 insertions(+), 36 deletions(-)

diff --git a/compiler/2014/Annotations.jrag b/compiler/2014/Annotations.jrag
index ea43c46..0f6b2f2 100644
--- a/compiler/2014/Annotations.jrag
+++ b/compiler/2014/Annotations.jrag
@@ -17,12 +17,12 @@ aspect Annotations {
     syn boolean Annotation.isIntention() = false;
     eq Intention.isIntention() = true;
 
-    inh AnnotatedNode Annotation.parentInstance();
-    eq AnnotatedNode.getAnnotations().parentInstance() = this;
+    inh TypeInstance Annotation.parentInstance();
+    eq TypeInstance.getAnnotations().parentInstance() = this;
 
-    coll Set<Intention> AnnotatedNode.intentionSet() [new HashSet<Intention>()] with add;
+    coll Set<Intention> TypeInstance.intentionSet() [new HashSet<Intention>()] with add;
     Intention contributes this
-        to AnnotatedNode.intentionSet()
+        to TypeInstance.intentionSet()
         for parentInstance();
 
 }
diff --git a/compiler/2014/LabComm.ast b/compiler/2014/LabComm.ast
index 92d2aab..6f3c02c 100644
--- a/compiler/2014/LabComm.ast
+++ b/compiler/2014/LabComm.ast
@@ -1,9 +1,8 @@
 Specification ::= Decl*;
 
-abstract AnnotatedNode ::= Annotations;
-abstract Decl : AnnotatedNode ::= TypeInstance /Signature/;
+abstract Decl ::= TypeInstance /Signature/;
 
-TypeInstance :AnnotatedNode ::= DataType;
+TypeInstance ::= DataType Annotations;
 
 Annotations ::= Annotation*;
 Annotation ::= <Key:String> <Value:byte[]>;
diff --git a/compiler/2014/LabCommParser.parser b/compiler/2014/LabCommParser.parser
index 8daff77..8c03350 100644
--- a/compiler/2014/LabCommParser.parser
+++ b/compiler/2014/LabCommParser.parser
@@ -82,10 +82,10 @@ Field var_decl =
   ;
 
 TypeDecl type_decl =
-    annotations.a TYPEDEF type_instance.t  SEMICOLON {: return new TypeDecl(t, a); :} ;
+    TYPEDEF type_instance.t  SEMICOLON {: return new TypeDecl(t); :} ;
 
 SampleDecl sample_decl =
-    annotations.a SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t, a); :} ;
+    SAMPLE type_instance.t SEMICOLON {: return new SampleDecl(t); :} ;
 
 DataType type =
     prim_type.p                     {: return p; :}
diff --git a/compiler/2014/Refactoring.jrag b/compiler/2014/Refactoring.jrag
index 42ecead..2e66939 100644
--- a/compiler/2014/Refactoring.jrag
+++ b/compiler/2014/Refactoring.jrag
@@ -5,22 +5,6 @@ aspect Refactoring {
 
     syn String TypeInstance.getName() = getAnnotations().getName();
 
-    public TypeDecl.TypeDecl(TypeInstance t, Annotations a) {
-        this(a, t);
-    }
-
-    public SampleDecl.SampleDecl(TypeInstance t, Annotations a) {
-        this(a, t);
-    }
-
-    public TypeInstance.TypeInstance(DataType t, Annotations a) {
-        this(a, t);
-    }
-
-    public Field.Field(DataType t, Annotations a) {
-        this(a, t);
-    }
-
     public Annotations Annotations.addName(String n) {
         //XXX TODO: check if name already exists
         addAnnotation(new Annotation("",n.getBytes()));
@@ -39,15 +23,5 @@ aspect Refactoring {
         this(t, new  Annotations().addName(n));
         System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list");
     }
-    public TypeDecl.TypeDecl(TypeInstance t) {
-        this(t, new  Annotations());
-        System.out.println("WARNING! TypeDecl(TypeInstance) ignoring intention list");
-    }
-    public SampleDecl.SampleDecl(TypeInstance t) {
-        this(t, new  Annotations());
-        System.out.println("WARNING! SampleDecl(TypeInstance) ignoring intention list");
-    }
-
-    syn Annotation Decl.getAnnotation(int i) = getAnnotations().getAnnotation(i);
     syn Annotation TypeInstance.getAnnotation(int i) = getAnnotations().getAnnotation(i);
 }
diff --git a/examples/user_types/test.lc b/examples/user_types/test.lc
index 353877f..fdc9d54 100644
--- a/examples/user_types/test.lc
+++ b/examples/user_types/test.lc
@@ -28,7 +28,7 @@ typedef struct {
   boolean c;
 } foo;
 
-(nisse:hej) sample struct {
+sample struct {
   (name:l1)line l1;
   (name:l2)line l2;
   (b:"kalle anka")(c:hejdu)(a:"kalle anka")foo  f;
-- 
GitLab