Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2019-12-02 17:14:51 +0000
committerEd Willink2019-12-02 17:14:51 +0000
commit977cc6854ee7c6a2a77dd88ca43a9565fcd6cc54 (patch)
treedfb41be44a79a9bade0aa6ce99b15b3cd2b4970f
parenta18ff752f9c12d39fd4aedcfb159f560a86b0a3c (diff)
downloadorg.eclipse.qvtd-977cc6854ee7c6a2a77dd88ca43a9565fcd6cc54.tar.gz
org.eclipse.qvtd-977cc6854ee7c6a2a77dd88ca43a9565fcd6cc54.tar.xz
org.eclipse.qvtd-977cc6854ee7c6a2a77dd88ca43a9565fcd6cc54.zip
ok utility edges
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/ExpressionSynthesizer.java49
1 files changed, 32 insertions, 17 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/ExpressionSynthesizer.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/ExpressionSynthesizer.java
index b411024df..293895493 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/ExpressionSynthesizer.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtb2qvts/ExpressionSynthesizer.java
@@ -164,6 +164,7 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
}
protected @NonNull Node createCollectionLiteral(@NonNull InitUtility utility, @NonNull CollectionLiteralExp collectionLiteralExp, @NonNull CollectionLiteralPart [] collectionParts, @NonNull Node @NonNull [] partNodes) {
+ InitUtility initUtility = getRequiredInitUtility(collectionLiteralExp);
Operation collectionOperation = qvtbaseLibraryHelper.getCollectionOperation();
assert collectionParts.length == partNodes.length;
Node reusedNode = findOperationNode(collectionOperation, partNodes);
@@ -175,9 +176,11 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
if (nodeName == null) {
nodeName = QVTbaseUtil.getName(collectionOperation);
}
- CollectionLiteralNode collectionLiteralNode = context.createCollectionLiteralNode(!resultUtility.isConditional(), resultUtility, nodeName, collectionLiteralExp, partNodes);
+ CollectionLiteralNode collectionLiteralNode = context.createCollectionLiteralNode(!resultUtility.isConditional(), initUtility, nodeName, collectionLiteralExp, partNodes);
for (int i = 0; i < collectionParts.length; i++) {
- context.createCollectionPartEdge(resultUtility, partNodes[i], collectionParts[i], collectionLiteralNode);
+ CollectionLiteralPart collectionPart = collectionParts[i];
+ InitUtility partInitUtility = getRequiredInitUtility(collectionPart);
+ context.createCollectionPartEdge(partInitUtility, partNodes[i], collectionPart, collectionLiteralNode);
}
return collectionLiteralNode;
}
@@ -241,6 +244,7 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
}
protected @NonNull Node createMapLiteral(@NonNull MapLiteralExp mapLiteralExp, @NonNull MapLiteralPart [] mapParts, @NonNull Node @NonNull [] partNodes) {
+ InitUtility initUtility = getRequiredInitUtility(mapLiteralExp);
assert mapParts.length == partNodes.length;
Operation mapOperation = qvtbaseLibraryHelper.getMapOperation();
Node reusedNode = findOperationNode(mapOperation, partNodes);
@@ -252,17 +256,15 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
if (nodeName == null) {
nodeName = QVTbaseUtil.getName(mapOperation);
}
- MapLiteralNode mapLiteralNode = context.createMapLiteralNode(!resultUtility.isConditional(), getRequiredInitUtility(mapLiteralExp), nodeName, mapLiteralExp, partNodes);
+ MapLiteralNode mapLiteralNode = context.createMapLiteralNode(!resultUtility.isConditional(), initUtility, nodeName, mapLiteralExp, partNodes);
for (int i = 0; i < mapParts.length; i++) {
- context.createMapPartEdge(resultUtility, partNodes[i], mapParts[i], mapLiteralNode);
+ MapLiteralPart mapPart = mapParts[i];
+ InitUtility partInitUtility = initUtility; //getRequiredInitUtility(mapPart);
+ context.createMapPartEdge(resultUtility, partNodes[i], mapPart, mapLiteralNode);
}
return mapLiteralNode;
}
- protected @NonNull Node createNavigableDataTypeNode(@NonNull InitUtility utility, @NonNull Node targetNode, @NonNull NavigationAssignment navigationAssignment) {
- return context.createDataTypeNode(utility, targetNode, navigationAssignment);
- }
-
protected @NonNull Node createMapPart(@NonNull MapLiteralPart mapLiteralPart, @NonNull Node keyNode, @NonNull Node valueNode) {
TypedElement typedElement = QVTbaseUtil.getOwnedValue(mapLiteralPart); // FIXME use real object
Operation partOperation = qvtbaseLibraryHelper.getMapPartOperation();
@@ -284,6 +286,10 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
return operationNode;
}
+ protected @NonNull Node createNavigableDataTypeNode(@NonNull InitUtility utility, @NonNull Node targetNode, @NonNull NavigationAssignment navigationAssignment) {
+ return context.createDataTypeNode(utility, targetNode, navigationAssignment);
+ }
+
protected @NonNull Node createNavigableDataTypeNode(@NonNull InitUtility utility, @NonNull Node sourceNode, @NonNull Property source2targetProperty) {
// assert sourceNode.isMatched();
return context.createDataTypeNode(utility, sourceNode, source2targetProperty);
@@ -298,6 +304,8 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
}
protected @NonNull NavigableEdge createNavigationOrRealizedEdge(@NonNull InitUtility utility, @NonNull Node sourceNode, @NonNull Property source2targetProperty, @NonNull Node targetNode, @Nullable NavigationAssignment navigationAssignment) {
+ InitUtility requiredInitUtility = getRequiredInitUtility(targetNode);
+ assert utility == requiredInitUtility;
NavigableEdge navigationEdge = sourceNode.getOutgoingNavigableEdge(source2targetProperty);
assert navigationEdge == null;
boolean isPartial = navigationAssignment != null ? navigationAssignment.isIsPartial() : scheduleManager.computeIsPartial(targetNode, source2targetProperty);
@@ -350,15 +358,16 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
return context.createDependencyClassNode(utility, parentNode, navigationAssignment);
}
- protected @NonNull Node createRealizedDataTypeNode(@NonNull InitUtility utility, @NonNull Node sourceNode, @NonNull Property source2targetProperty) {
- return context.createRealizedDataTypeNode(utility, sourceNode, source2targetProperty);
- }
+ // protected @NonNull Node createRealizedDataTypeNode(@NonNull InitUtility utility, @NonNull Node sourceNode, @NonNull Property source2targetProperty) {
+ // return context.createRealizedDataTypeNode(utility, sourceNode, source2targetProperty);
+ // }
protected @NonNull NavigableEdge createRealizedNavigationEdge(@NonNull InitUtility utility, @NonNull Node sourceNode, @NonNull Property source2targetProperty, @NonNull Node targetNode, boolean isPartial) {
return context.createRealizedNavigationEdge(utility, sourceNode, source2targetProperty, targetNode, isPartial);
}
protected @NonNull Node createShadow(@NonNull ShadowExp shadowExp, @NonNull ShadowPart [] shadowParts, @NonNull Node @NonNull [] partNodes) {
+ InitUtility initUtility = getRequiredInitUtility(shadowExp);
assert shadowParts.length == partNodes.length;
Operation shadowOperation = qvtbaseLibraryHelper.getShadowOperation();
Node reusedNode = findOperationNode(shadowOperation, partNodes);
@@ -370,9 +379,11 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
if (nodeName == null) {
nodeName = QVTbaseUtil.getName(shadowOperation);
}
- ShadowNode shadowLiteralNode = context.createShadowNode(!resultUtility.isConditional(), resultUtility, nodeName, shadowExp, partNodes);
+ ShadowNode shadowLiteralNode = context.createShadowNode(!resultUtility.isConditional(), initUtility, nodeName, shadowExp, partNodes);
for (int i = 0; i < shadowParts.length; i++) {
- context.createShadowPartEdge(resultUtility, partNodes[i], shadowParts[i], shadowLiteralNode);
+ ShadowPart shadowPart = shadowParts[i];
+ InitUtility partInitUtility = getRequiredInitUtility(shadowPart);
+ context.createShadowPartEdge(partInitUtility, partNodes[i], shadowPart, shadowLiteralNode);
}
return shadowLiteralNode;
}
@@ -383,10 +394,12 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
}
protected @NonNull Node createStringLiteralNode(@NonNull String stringValue, @NonNull StringLiteralExp stringLiteralExp) {
- return context.createStringLiteralNode(!resultUtility.isConditional(), getRequiredInitUtility(stringLiteralExp), stringValue, stringLiteralExp);
+ InitUtility initUtility = getRequiredInitUtility(stringLiteralExp);
+ return context.createStringLiteralNode(!resultUtility.isConditional(), initUtility, stringValue, stringLiteralExp);
}
protected @NonNull Node createTupleLiteral(@NonNull TupleLiteralExp tupleLiteralExp, @NonNull TupleLiteralPart [] tupleParts, @NonNull Node @NonNull [] partNodes) {
+ InitUtility initUtility = getRequiredInitUtility(tupleLiteralExp);
assert tupleParts.length == partNodes.length;
Operation tupleOperation = qvtbaseLibraryHelper.getTupleOperation();
Node reusedNode = findOperationNode(tupleOperation, partNodes);
@@ -398,9 +411,11 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
if (nodeName == null) {
nodeName = QVTbaseUtil.getName(tupleOperation);
}
- TupleLiteralNode tupleLiteralNode = context.createTupleLiteralNode(!resultUtility.isConditional(), resultUtility, nodeName, tupleLiteralExp, partNodes);
+ TupleLiteralNode tupleLiteralNode = context.createTupleLiteralNode(!resultUtility.isConditional(), initUtility, nodeName, tupleLiteralExp, partNodes);
for (int i = 0; i < tupleParts.length; i++) {
- context.createTuplePartEdge(resultUtility, partNodes[i], tupleParts[i], tupleLiteralNode);
+ TupleLiteralPart tuplePart = tupleParts[i];
+ InitUtility partInitUtility = getRequiredInitUtility(tuplePart);
+ context.createTuplePartEdge(partInitUtility, partNodes[i], tuplePart, tupleLiteralNode);
}
return tupleLiteralNode;
}
@@ -788,7 +803,7 @@ public abstract class ExpressionSynthesizer extends AbstractExtendingQVTbaseVisi
}
else {
// navigationEdge = createRealizedEdge(sourceNode, source2targetProperty, targetNode);
- navigationEdge = createNavigationOrRealizedEdge(getRequiredInitUtility(source2targetProperty), sourceNode, source2targetProperty, targetNode, navigationAssignment);
+ navigationEdge = createNavigationOrRealizedEdge(getRequiredInitUtility(targetNode), sourceNode, source2targetProperty, targetNode, navigationAssignment);
// Property target2sourceProperty = source2targetProperty.getOpposite(); // FIXME move to createEdge
// if (targetNode.isClassNode() && (target2sourceProperty != null) && !target2sourceProperty.isIsMany()) {
// createRealizedEdge(targetNode, target2sourceProperty, sourceNode);

Back to the top