Skip to content
Snippets Groups Projects
Commit d019bc58 authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

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
parent 01ee3b1c
Branches
No related tags found
No related merge requests found
...@@ -17,12 +17,12 @@ aspect Annotations { ...@@ -17,12 +17,12 @@ aspect Annotations {
syn boolean Annotation.isIntention() = false; syn boolean Annotation.isIntention() = false;
eq Intention.isIntention() = true; eq Intention.isIntention() = true;
inh AnnotatedNode Annotation.parentInstance(); inh TypeInstance Annotation.parentInstance();
eq AnnotatedNode.getAnnotations().parentInstance() = this; 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 Intention contributes this
to AnnotatedNode.intentionSet() to TypeInstance.intentionSet()
for parentInstance(); for parentInstance();
} }
......
Specification ::= Decl*; Specification ::= Decl*;
abstract AnnotatedNode ::= Annotations; abstract Decl ::= TypeInstance /Signature/;
abstract Decl : AnnotatedNode ::= TypeInstance /Signature/;
TypeInstance :AnnotatedNode ::= DataType; TypeInstance ::= DataType Annotations;
Annotations ::= Annotation*; Annotations ::= Annotation*;
Annotation ::= <Key:String> <Value:byte[]>; Annotation ::= <Key:String> <Value:byte[]>;
......
...@@ -82,10 +82,10 @@ Field var_decl = ...@@ -82,10 +82,10 @@ Field var_decl =
; ;
TypeDecl type_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 = 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 = DataType type =
prim_type.p {: return p; :} prim_type.p {: return p; :}
......
...@@ -5,22 +5,6 @@ aspect Refactoring { ...@@ -5,22 +5,6 @@ aspect Refactoring {
syn String TypeInstance.getName() = getAnnotations().getName(); 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) { public Annotations Annotations.addName(String n) {
//XXX TODO: check if name already exists //XXX TODO: check if name already exists
addAnnotation(new Annotation("",n.getBytes())); addAnnotation(new Annotation("",n.getBytes()));
...@@ -39,15 +23,5 @@ aspect Refactoring { ...@@ -39,15 +23,5 @@ aspect Refactoring {
this(t, new Annotations().addName(n)); this(t, new Annotations().addName(n));
System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list"); 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); syn Annotation TypeInstance.getAnnotation(int i) = getAnnotations().getAnnotation(i);
} }
...@@ -28,7 +28,7 @@ typedef struct { ...@@ -28,7 +28,7 @@ typedef struct {
boolean c; boolean c;
} foo; } foo;
(nisse:hej) sample struct { sample struct {
(name:l1)line l1; (name:l1)line l1;
(name:l2)line l2; (name:l2)line l2;
(b:"kalle anka")(c:hejdu)(a:"kalle anka")foo f; (b:"kalle anka")(c:hejdu)(a:"kalle anka")foo f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment