Navigation.jrag 4.2 KB
Newer Older
1
2
aspect Navigation {

3
  // --- program ---
4
5
  eq RagConnect.getChild().program() = getProgram();
  eq MRagConnect.getChild().program() = getRagConnect().program();
6

7
8
9
10
  // --- ragconnect ---
  inh RagConnect ASTNode.ragconnect();
  eq RagConnect.getChild().ragconnect() = this;
  eq MRagConnect.getChild().ragconnect() = getRagConnect();
11

12
  // --- containedFile
René Schöne's avatar
René Schöne committed
13
  eq Grammar.getChild().containedFile() = null;
14
  eq RagConnect.getChild().containedFile() = null;
René Schöne's avatar
René Schöne committed
15
  eq MRagConnect.getChild().containedFile() = null;
René Schöne's avatar
René Schöne committed
16

17
  // --- containedFileName ---
18
  eq Grammar.getChild().containedFileName() = null;  // should be in PP
19
20
  eq RagConnect.getChild().containedFileName() = getFileName();
  eq MRagConnect.getChild().containedFileName() = null;
René Schöne's avatar
René Schöne committed
21

22
23
24
  // --- isTokenEndpointDefinition ---
  syn boolean EndpointDefinition.isTokenEndpointDefinition() = false;
  eq TokenEndpointDefinition.isTokenEndpointDefinition() = true;
René Schöne's avatar
René Schöne committed
25

26
27
28
  // --- asTokenEndpointDefinition ---
  syn TokenEndpointDefinition EndpointDefinition.asTokenEndpointDefinition() = null;
  eq TokenEndpointDefinition.asTokenEndpointDefinition() = this;
René Schöne's avatar
René Schöne committed
29

30
31
32
  // --- isTypeEndpointDefinition ---
  syn boolean EndpointDefinition.isTypeEndpointDefinition() = false;
  eq TypeEndpointDefinition.isTypeEndpointDefinition() = true;
René Schöne's avatar
René Schöne committed
33

34
35
36
  // --- asTypeEndpointDefinition ---
  syn TypeEndpointDefinition EndpointDefinition.asTypeEndpointDefinition() = null;
  eq TypeEndpointDefinition.asTypeEndpointDefinition() = this;
René Schöne's avatar
René Schöne committed
37

René Schöne's avatar
René Schöne committed
38
39
40
41
  // --- isReceiveTokenEndpointDefinition ---
  syn boolean EndpointDefinition.isReceiveTokenEndpointDefinition() = false;
  eq ReceiveTokenEndpointDefinition.isReceiveTokenEndpointDefinition() = true;

René Schöne's avatar
René Schöne committed
42
43
44
  // --- asReceiveTokenEndpointDefinition ---
  syn ReceiveTokenEndpointDefinition EndpointDefinition.asReceiveTokenEndpointDefinition() = null;
  eq ReceiveTokenEndpointDefinition.asReceiveTokenEndpointDefinition() = this;
René Schöne's avatar
René Schöne committed
45

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  // --- isSendTokenEndpointDefinition ---
  syn boolean EndpointDefinition.isSendTokenEndpointDefinition() = false;
  eq SendTokenEndpointDefinition.isSendTokenEndpointDefinition() = true;

  // --- asSendTokenEndpointDefinition ---
  syn SendTokenEndpointDefinition EndpointDefinition.asSendTokenEndpointDefinition() = null;
  eq SendTokenEndpointDefinition.asSendTokenEndpointDefinition() = this;

  // --- isReceiveTypeEndpointDefinition ---
  syn boolean EndpointDefinition.isReceiveTypeEndpointDefinition() = false;
  eq ReceiveTypeEndpointDefinition.isReceiveTypeEndpointDefinition() = true;

  // --- asReceiveTypeEndpointDefinition ---
  syn ReceiveTypeEndpointDefinition EndpointDefinition.asReceiveTypeEndpointDefinition() = null;
  eq ReceiveTypeEndpointDefinition.asReceiveTypeEndpointDefinition() = this;

  // --- isSendTypeEndpointDefinition ---
  syn boolean EndpointDefinition.isSendTypeEndpointDefinition() = false;
  eq SendTypeEndpointDefinition.isSendTypeEndpointDefinition() = true;

  // --- asSendTypeEndpointDefinition ---
  syn SendTypeEndpointDefinition EndpointDefinition.asSendTypeEndpointDefinition() = null;
  eq SendTypeEndpointDefinition.asSendTypeEndpointDefinition() = this;

70
  // --- targetEndpointDefinition ---
René Schöne's avatar
René Schöne committed
71
  syn SendTokenEndpointDefinition DependencyDefinition.targetEndpointDefinition() {
René Schöne's avatar
René Schöne committed
72
    // resolve definition in here, as we do not need resolveMethod in any other place (yet)
73
    for (EndpointDefinition endpointDefinition : ragconnect().getEndpointDefinitionList()) {
René Schöne's avatar
René Schöne committed
74
75
76
      if (endpointDefinition.isSendTokenEndpointDefinition() &&
          endpointDefinition.asSendTokenEndpointDefinition().getToken().equals(this.getTarget())) {
        return endpointDefinition.asSendTokenEndpointDefinition();
René Schöne's avatar
René Schöne committed
77
78
79
80
      }
    }
    return null;
  }
81

René Schöne's avatar
René Schöne committed
82
83
84
  // --- effectiveJavaTypeUse (should be in preprocessor) ---
  syn lazy JavaTypeUse TokenComponent.effectiveJavaTypeUse() = hasJavaTypeUse() ? getJavaTypeUse() : new SimpleJavaTypeUse("String");

85
86
87
  // --- isDefaultMappingDefinition ---
  syn boolean MappingDefinition.isDefaultMappingDefinition() = false;
  eq DefaultMappingDefinition.isDefaultMappingDefinition() = true;
René Schöne's avatar
René Schöne committed
88
89
90
91
92
93
94

  // --- mragconnect ---
  inh MRagConnect MHandler.mragconnect();
  eq MRagConnect.getHandler().mragconnect() = this;

  // --- rootTypeComponents ---
  syn JastAddList<MTypeComponent> MHandler.rootTypeComponents() = mragconnect().getRootTypeComponents();
95
}