Refactoring.jrag 972 Bytes
Newer Older
1
2
3
4
5
/* Temporary aspect with forwarding methods */
aspect Refactoring {
    syn String Decl.getName() = getTypeInstance().getName();
    syn DataType Decl.getDataType() = getTypeInstance().getDataType();

6
7
8
9
    syn String TypeInstance.getName() = getAnnotations().getName();

    public Annotations Annotations.addName(String n) {
        //XXX TODO: check if name already exists
10
        addAnnotation(new Intention("",n.getBytes()));
11
12
13
        return this;
    }

14
    public Field.Field(TypeInstance t) {
15
        this(t.getDataType(), t.getAnnotations());
16
17
18
19
    }

    public TypeInstance.TypeInstance(DataType t, String n, Annotations a) {
        this(t, a.addName(n));
20
21
22
    }

    public TypeInstance.TypeInstance(DataType t, String n) {
23
        this(t, new  Annotations().addName(n));
24
        System.out.println("WARNING! TypeInstance(DataType, String) ignoring intention list");
25
    }
26
    syn Annotation TypeInstance.getAnnotation(int i) = getAnnotations().getAnnotation(i);
27
}