Skip to content
Snippets Groups Projects
Commit d1df8b82 authored by René Schöne's avatar René Schöne
Browse files

Change component resolving for inherited children of type-decls.

- use equals to compare entry in RagConnectObserver
- use type-components computed by NTA ("as owned by me") consistently
parent a3a28e6c
No related branches found
No related tags found
1 merge request!37Resolve "Inherited components of a type can not be chosen as port targets"
Pipeline #15502 failed
...@@ -75,8 +75,9 @@ However, depending on the selected protocols and/or used features, additional de ...@@ -75,8 +75,9 @@ However, depending on the selected protocols and/or used features, additional de
- Required runtime dependencies: _none_ - Required runtime dependencies: _none_
- Required options for RelAST compiler: _none_ - Required options for RelAST compiler: _none_
- Required options for JastAdd: - Required options for JastAdd:
- `--incremental` - `--incremental=param` (enable incremental evaluation)
- `--tracing=flush` - `--tracing=flush` (enable tracing of events)
- `--cache=all` (set all attributes to be cached)
- Remarks: - Remarks:
- Other (additional) values passed to those two options must be equal (e.g., `--incremental=param` passed to RagConnect must be also passed to JastAdd) - Other (additional) values passed to those two options must be equal (e.g., `--incremental=param` passed to RagConnect must be also passed to JastAdd)
- Other values besides `flush` can be added to `--tracing` - Other values besides `flush` can be added to `--tracing`
......
...@@ -398,7 +398,7 @@ aspect MustacheReceiveAndSendAndHandleUri { ...@@ -398,7 +398,7 @@ aspect MustacheReceiveAndSendAndHandleUri {
syn String PortDefinition.connectParameterName() = "uriString"; syn String PortDefinition.connectParameterName() = "uriString";
syn String PortDefinition.disconnectMethodName() { syn String PortDefinition.disconnectMethodName() {
// if both (send and receive) are defined for an port, ensure methods with different names // if both (send and receive) are defined for a port, ensure methods with different names
String extra; String extra;
if (getPortTarget().isTokenPortTarget()) { if (getPortTarget().isTokenPortTarget()) {
extra = lookupTokenPortDefinitions(token()).size() > 1 ? uniqueSuffix() : ""; extra = lookupTokenPortDefinitions(token()).size() > 1 ? uniqueSuffix() : "";
...@@ -681,7 +681,7 @@ aspect MustacheTypeDecl { ...@@ -681,7 +681,7 @@ aspect MustacheTypeDecl {
syn List<TypeComponent> TypeDecl.occurencesInProductionRules() { syn List<TypeComponent> TypeDecl.occurencesInProductionRules() {
List<TypeComponent> result = new ArrayList<>(); List<TypeComponent> result = new ArrayList<>();
for (TypeDecl typeDecl : program().typeDecls()) { for (TypeDecl typeDecl : program().typeDecls()) {
for (Component comp : typeDecl.getComponentList()) { for (Component comp : typeDecl.allComponentsAsOwnedByMe()) {
if (comp.isTypeComponent() && comp.asTypeComponent().getTypeDecl().equals(this)) { if (comp.isTypeComponent() && comp.asTypeComponent().getTypeDecl().equals(this)) {
result.add(comp.asTypeComponent()); result.add(comp.asTypeComponent());
} }
......
...@@ -27,7 +27,7 @@ aspect RagConnectNameResolution { ...@@ -27,7 +27,7 @@ aspect RagConnectNameResolution {
java.util.List<PortDefinition> result = new java.util.ArrayList<>(); java.util.List<PortDefinition> result = new java.util.ArrayList<>();
for (PortDefinition def : onlyGiven ? givenPortDefinitionList() : allPortDefinitionList()) { for (PortDefinition def : onlyGiven ? givenPortDefinitionList() : allPortDefinitionList()) {
PortTarget target = def.getPortTarget(); PortTarget target = def.getPortTarget();
if (target.isTypePortTarget() && target.asTypePortTarget().getType().equals(type)) { if (target.isTypePortTarget() && target.asTypePortTarget().getType().matches(type) && target.asTypePortTarget().getType().containingTypeDecl().equals(type.containingTypeDecl())) {
result.add(def); result.add(def);
} }
} }
...@@ -216,9 +216,7 @@ aspect RelastNameResolution { ...@@ -216,9 +216,7 @@ aspect RelastNameResolution {
if (!other.isTokenComponent()) { return false; } if (!other.isTokenComponent()) { return false; }
return getName().equals(other.getName()) && getJavaTypeUse().prettyPrint().equals(other.asTokenComponent().getJavaTypeUse().prettyPrint()); return getName().equals(other.getName()) && getJavaTypeUse().prettyPrint().equals(other.asTokenComponent().getJavaTypeUse().prettyPrint());
} }
eq TypeComponent.matches(Component other) { eq TypeComponent.matches(Component other) = matchesNameAndType(other);
return getName().equals(other.getName()) && getTypeDecl().equals(other.asTypeComponent().getTypeDecl());
}
eq NormalComponent.matches(Component other) { eq NormalComponent.matches(Component other) {
if (!other.isTypeComponent() || !other.asTypeComponent().isNormalComponent()) { return false; } if (!other.isTypeComponent() || !other.asTypeComponent().isNormalComponent()) { return false; }
return super.matches(other); return super.matches(other);
...@@ -231,4 +229,7 @@ aspect RelastNameResolution { ...@@ -231,4 +229,7 @@ aspect RelastNameResolution {
if (!other.isTypeComponent() || !other.asTypeComponent().isOptComponent()) { return false; } if (!other.isTypeComponent() || !other.asTypeComponent().isOptComponent()) { return false; }
return super.matches(other); return super.matches(other);
} }
syn boolean TypeComponent.matchesNameAndType(Component other) {
return getName().equals(other.getName()) && getTypeDecl().equals(other.asTypeComponent().getTypeDecl());
}
} }
...@@ -119,8 +119,8 @@ aspect RagConnectObserver { ...@@ -119,8 +119,8 @@ aspect RagConnectObserver {
} }
RagConnectObserverStartEntry startEntry = startEntries.peekFirst(); RagConnectObserverStartEntry startEntry = startEntries.peekFirst();
if (node == startEntry.node && if (node == startEntry.node &&
attribute == startEntry.attributeString && attribute.equals(startEntry.attributeString) &&
value == startEntry.flushIncToken) { value.equals(startEntry.flushIncToken)) {
// create a copy of the queue to avoid entering this again causing an endless recursion // create a copy of the queue to avoid entering this again causing an endless recursion
RagConnectObserverEntry[] entriesToProcess = entryQueue.toArray(new RagConnectObserverEntry[entryQueue.size()]); RagConnectObserverEntry[] entriesToProcess = entryQueue.toArray(new RagConnectObserverEntry[entryQueue.size()]);
entryQueue.clear(); entryQueue.clear();
......
...@@ -91,6 +91,7 @@ aspect RagConnect { ...@@ -91,6 +91,7 @@ aspect RagConnect {
mayHaveRewrite(); mayHaveRewrite();
// check if --incremental is active // check if --incremental is active
Object checkIncremental = inc_throwAway_visited; Object checkIncremental = inc_throwAway_visited;
{{! TODO maybe check for something like _ragconnect_mqttHandler_computed to see if --cache=all }}
{{/configIncrementalOptionActive}} {{/configIncrementalOptionActive}}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment