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
......@@ -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();
}
......
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[]>;
......
......@@ -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; :}
......
......@@ -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);
}
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment