Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2017-02-25 13:23:38 +0000
committerEd Willink2017-02-25 14:14:01 +0000
commitdcffe660f7aa5a35b06c998372c8a412da427e45 (patch)
tree4f90ffd838cae32ed3b4fbfacaf01edd9e258e9e
parent82cf04ce8a6517bcd7fc1bd7af5b83b54d8c8f23 (diff)
downloadorg.eclipse.qvtd-ewillink/512682.tar.gz
org.eclipse.qvtd-ewillink/512682.tar.xz
org.eclipse.qvtd-ewillink/512682.zip
Eliminate redundant equals edge to a variable initializerewillink/512682
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java68
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/MappingAnalysis.java159
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/QVTm2QVTs.java11
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/RegionUtil.java60
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java36
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/AbstractPartition.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtu2qvtm/QVTu2QVTm.java32
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/emf-gen/org/eclipse/qvtd/pivot/qvtimperative/impl/NewStatementImpl.java21
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtschedule/src/org/eclipse/qvtd/pivot/qvtschedule/utilities/QVTscheduleConstants.java1
9 files changed, 244 insertions, 148 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java
index a32eee23a..2a858d510 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/ExpressionAnalyzer.java
@@ -73,6 +73,7 @@ import org.eclipse.qvtd.pivot.qvtschedule.NavigableEdge;
import org.eclipse.qvtd.pivot.qvtschedule.Node;
import org.eclipse.qvtd.pivot.qvtschedule.OperationRegion;
import org.eclipse.qvtd.pivot.qvtschedule.utilities.QVTscheduleConstants;
+
import com.google.common.collect.Iterables;
public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullable Node, @NonNull MappingAnalysis>
@@ -133,9 +134,8 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
// if ((operationCallExp.getOwnedSource() instanceof CallExp) && sourceNode.refineClassDatumAnalysis(scheduler.getClassDatumAnalysis(operationCallExp))) {
// return sourceNode;
// }
- Type type = operationCallExp.getType();
- assert type != null;
- CompleteClass requiredClass = environmentFactory.getCompleteModel().getCompleteClass(type);
+ Type castType = QVTcoreUtil.getType(operationCallExp);
+ CompleteClass requiredClass = environmentFactory.getCompleteModel().getCompleteClass(castType);
CompleteClass predicatedClass = sourceNode.getCompleteClass();
if (predicatedClass.conformsTo(requiredClass)) {
sourceNode.addTypedElement(operationCallExp);
@@ -149,8 +149,6 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
return targetNode; // Re-use a pre-existing class
}
}
- Type castType = type;
- assert castType != null;
Property castProperty = scheduleManager.getCastProperty(castType);
Edge castEdge = sourceNode.getPredicateEdge(castProperty);
if (castEdge != null) {
@@ -200,8 +198,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
}
}
else {
- String name = operationCallExp.getReferredOperation().getName();
- assert name != null;
+ String name = QVTcoreUtil.getName(QVTcoreUtil.getReferredOperation(operationCallExp));
Node argumentNode = analyze(argument);
operationNode = findOperationNode(name, sourceNode, argumentNode);
if (operationNode == null) {
@@ -212,15 +209,13 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
}
private @NonNull Node analyzeOperationCallExp_oclContainer(@NonNull Node sourceNode, @NonNull OperationCallExp operationCallExp) {
- Type castType = operationCallExp.getType();
- assert castType != null;
+ // Type castType = QVTcoreUtil.getType(operationCallExp);
Property oclContainerProperty = standardLibraryHelper.getOclContainerProperty();
Edge oclContainerEdge = sourceNode.getPredicateEdge(oclContainerProperty);
if (oclContainerEdge != null) {
return oclContainerEdge.getEdgeTarget();
}
- String name = operationCallExp.getReferredOperation().getName();
- assert name != null;
+ String name = QVTcoreUtil.getName(QVTcoreUtil.getReferredOperation(operationCallExp));
Node oclContainerNode = createStepNode(name, operationCallExp, sourceNode);
oclContainerEdge = createNavigationEdge(sourceNode, oclContainerProperty, oclContainerNode, false);
return oclContainerNode;
@@ -285,7 +280,11 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
}
boolean isMatched = RegionUtil.isMatched(typedElement);
ExpressionAnalyzer nestedAnalyzer = isMatched ? this : getConditionalExpressionAnalyzer();
- Node operationNode = nestedAnalyzer.createOperationNode(name, typedElement, sourceAndArgumentNodes);
+ String nodeName = RegionUtil.recoverVariableName(typedElement);
+ if (nodeName == null) {
+ nodeName = name;
+ }
+ Node operationNode = nestedAnalyzer.createOperationNode(nodeName, typedElement, sourceAndArgumentNodes);
for (int i = 0; i < sourceAndArgumentNodes.length; i++) {
nestedAnalyzer.createExpressionEdge(ClassUtil.nonNullState(sourceAndArgumentNodes[i]), argNames[i], operationNode);
}
@@ -296,8 +295,8 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
return RegionUtil.createCastEdge(sourceNode, castProperty, castNode);
}
- protected @NonNull Node createDataTypeNode(@NonNull Node sourceNode, @NonNull Property property, @NonNull NavigationCallExp navigationCallExp) {
- return RegionUtil.createDataTypeNode(sourceNode, navigationCallExp);
+ protected @NonNull Node createDataTypeNode(@NonNull String name, @NonNull Node sourceNode, @NonNull NavigationCallExp navigationCallExp) {
+ return RegionUtil.createDataTypeNode(name, sourceNode, navigationCallExp);
}
protected @NonNull Node createDependencyNode(@NonNull String name, @NonNull ClassDatumAnalysis classDatumAnalysis) {
@@ -620,8 +619,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
Variable ownedVariable = letExp.getOwnedVariable();
Node initNode = analyze(ownedVariable.getOwnedInit());
assert initNode != null;
- Type type = ownedVariable.getType();
- assert type != null;
+ Type type = QVTcoreUtil.getType(ownedVariable);
CompleteClass actualClass = initNode.getCompleteClass();
ClassDatumAnalysis classDatumAnalysis = scheduleManager.getClassDatumAnalysis(ownedVariable);
CompleteClass requiredClass = RegionUtil.getCompleteClass(classDatumAnalysis);
@@ -652,18 +650,17 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
int i = 1;
for (@NonNull Variable iterator : ownedIterators) {
Node iteratorNode = createIteratorNode(iterator, sourceNode);
- Type iteratorType = iterator.getType();
- assert iteratorType != null;
+ @SuppressWarnings("unused")
+ Type iteratorType = QVTcoreUtil.getType(iterator);
// Property iterateProperty = context.getScheduleModel().getIterateProperty(iteratorType);
createIteratedEdge(sourceNode, QVTscheduleConstants.LOOP_ITERATOR_NAME, iteratorNode);
argNodes[i++] = iteratorNode;
}
if (loopExp instanceof IterateExp) {
- Variable accumulator = ((IterateExp)loopExp).getOwnedResult();
- assert accumulator != null;
+ Variable accumulator = QVTcoreUtil.getOwnedResult((IterateExp)loopExp);
Node iteratorNode = createIteratorNode(accumulator, sourceNode);
- Type iteratorType = accumulator.getType();
- assert iteratorType != null;
+ @SuppressWarnings("unused")
+ Type iteratorType = QVTcoreUtil.getType(accumulator);
// Property iterateProperty = context.getScheduleModel().getIterateProperty(iteratorType);
createIteratedEdge(sourceNode, QVTscheduleConstants.LOOP_ITERATOR_NAME, iteratorNode);
argNodes[i++] = iteratorNode;
@@ -676,8 +673,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
createExpressionEdge(bodyNode, QVTscheduleConstants.LOOP_BODY_NAME, accumulateNode);
i = 1;
for (@NonNull Variable iterator : ownedIterators) {
- Node iteratorNode = argNodes[i++];
- assert iteratorNode != null;
+ @NonNull Node iteratorNode = argNodes[i++];
createExpressionEdge(iteratorNode, "«" + iterator.getName() + "»", accumulateNode);
}
return accumulateNode;
@@ -697,8 +693,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
@Override
public @NonNull Node visitMapLiteralPart(@NonNull MapLiteralPart mapLiteralPart) {
- OCLExpression ownedValue = mapLiteralPart.getOwnedValue();
- assert ownedValue != null;
+ OCLExpression ownedValue = QVTcoreUtil.getOwnedValue(mapLiteralPart);
Node keyNode = analyze(mapLiteralPart.getOwnedKey());
Node valueNode = analyze(ownedValue);
Node operationNode = createConnectedOperationNode("Part", mapArgNames, ownedValue, keyNode, valueNode);
@@ -734,9 +729,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
public @NonNull Node visitNavigationCallExp(@NonNull NavigationCallExp navigationCallExp) {
assert !navigationCallExp.isIsSafe();
Property referredProperty = PivotUtil.getReferredProperty(navigationCallExp);
- assert referredProperty != null;
- OCLExpression ownedSource = navigationCallExp.getOwnedSource();
- assert ownedSource != null;
+ OCLExpression ownedSource = QVTcoreUtil.getOwnedSource(navigationCallExp);
Node sourceNode = analyze(ownedSource);
if (sourceNode.isClass()) {
if (!referredProperty.isIsMany()) {
@@ -745,18 +738,19 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
return navigationEdge.getEdgeTarget();
}
}
- Type type = referredProperty.getType();
- assert type != null;
+ String name = RegionUtil.recoverVariableName(navigationCallExp);
+ if (name == null) {
+ name = QVTcoreUtil.getName(referredProperty);
+ }
+ Type type = QVTcoreUtil.getType(referredProperty);
Node targetNode;
if (type instanceof DataType) {
targetNode = sourceNode.getNavigationTarget(referredProperty);
if (targetNode == null) {
- targetNode = createDataTypeNode(sourceNode, referredProperty, navigationCallExp);
+ targetNode = createDataTypeNode(name, sourceNode, navigationCallExp);
}
}
else {
- String name = referredProperty.getName();
- assert name != null;
targetNode = createStepNode(name, navigationCallExp, sourceNode);
}
getNavigationEdge(sourceNode, referredProperty, targetNode, null);
@@ -931,8 +925,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
@Override
public @NonNull Node visitTypeExp(@NonNull TypeExp typeExp) {
DomainUsage domainUsage = scheduleManager.getDomainUsage(typeExp);
- Type referredType = typeExp.getReferredType();
- assert referredType != null;
+ Type referredType = QVTcoreUtil.getReferredType(typeExp);
TypedModel typedModel = domainUsage.getTypedModel(typeExp);
assert typedModel != null;
ClassDatumAnalysis classDatumAnalysis = scheduleManager.getClassDatumAnalysis((org.eclipse.ocl.pivot.Class)referredType, typedModel);
@@ -948,8 +941,7 @@ public class ExpressionAnalyzer extends AbstractExtendingQVTcoreVisitor<@Nullabl
@Override
public @NonNull Node visitVariableExp(@NonNull VariableExp variableExp) {
- VariableDeclaration referredVariable = variableExp.getReferredVariable();
- assert referredVariable != null;
+ VariableDeclaration referredVariable = QVTcoreUtil.getReferredVariable(variableExp);
return context.getReferenceNode(referredVariable);
}
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/MappingAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/MappingAnalysis.java
index 19738041d..20ddcb9fa 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/MappingAnalysis.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/MappingAnalysis.java
@@ -11,8 +11,10 @@
package org.eclipse.qvtd.compiler.internal.qvtm2qvts;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
@@ -31,17 +33,17 @@ import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.Nameable;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.qvtd.compiler.internal.qvts2qvts.ClassDatumAnalysis;
-import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
-import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtcore.Assignment;
import org.eclipse.qvtd.pivot.qvtcore.BottomPattern;
+import org.eclipse.qvtd.pivot.qvtcore.BottomVariable;
import org.eclipse.qvtd.pivot.qvtcore.CoreDomain;
import org.eclipse.qvtd.pivot.qvtcore.CorePattern;
import org.eclipse.qvtd.pivot.qvtcore.GuardPattern;
import org.eclipse.qvtd.pivot.qvtcore.Mapping;
import org.eclipse.qvtd.pivot.qvtcore.NavigationAssignment;
import org.eclipse.qvtd.pivot.qvtcore.RealizedVariable;
+import org.eclipse.qvtd.pivot.qvtcore.VariableAssignment;
import org.eclipse.qvtd.pivot.qvtcore.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcoreUtil;
import org.eclipse.qvtd.pivot.qvtschedule.Edge;
@@ -90,6 +92,12 @@ public class MappingAnalysis implements Nameable
private final @NonNull List<@NonNull NavigationAssignment> navigationAssignments = new ArrayList<>();
/**
+ * The variable initializers, simple predicate reference expression and variable assignment values that define a value for each variable.
+ * Variable initializers are populated lazily since not all LetVariables may even exist for an eager population.
+ */
+ private @NonNull Map<@NonNull VariableDeclaration, @NonNull List<@NonNull OCLExpression>> variable2expressions = new HashMap<>();
+
+ /**
* The dependency heads to accommodate operation content.
*/
private /*@LazyNonNull*/ List<@NonNull Node> dependencyHeadNodes = null;
@@ -101,25 +109,47 @@ public class MappingAnalysis implements Nameable
mappingRegion.setReferredMapping(mapping);
this.expressionAnalyzer = new ExpressionAnalyzer(this);
//
- guardPatterns.add(ClassUtil.nonNull(mapping.getGuardPattern()));
- bottomPatterns.add(ClassUtil.nonNull(mapping.getBottomPattern()));
- for (Domain domain : mapping.getDomain()) {
- if (domain instanceof CoreDomain) {
- CoreDomain coreDomain = (CoreDomain)domain;
- //
- GuardPattern guardPattern = ClassUtil.nonNull(coreDomain.getGuardPattern());
- BottomPattern bottomPattern = ClassUtil.nonNull(coreDomain.getBottomPattern());
- guardPatterns.add(guardPattern);
- bottomPatterns.add(bottomPattern);
- for (@NonNull Assignment assignment : ClassUtil.nullFree(bottomPattern.getAssignment())) {
- if (assignment instanceof NavigationAssignment) {
- navigationAssignments.add((NavigationAssignment)assignment);
- }
+ GuardPattern guardPattern = QVTcoreUtil.getGuardPattern(mapping);
+ BottomPattern bottomPattern = QVTcoreUtil.getBottomPattern(mapping);
+ guardPatterns.add(guardPattern);
+ bottomPatterns.add(bottomPattern);
+ for (@NonNull Assignment assignment : QVTcoreUtil.getOwnedAssignments(bottomPattern)) {
+ if (assignment instanceof NavigationAssignment) {
+ navigationAssignments.add((NavigationAssignment)assignment);
+ }
+ else if (assignment instanceof VariableAssignment) {
+ VariableAssignment variableAssignment = (VariableAssignment)assignment;
+ addExpression(QVTcoreUtil.getTargetVariable(variableAssignment), QVTcoreUtil.getValue(variableAssignment));
+ }
+ }
+ for (@NonNull CoreDomain coreDomain : QVTcoreUtil.getOwnedDomains(mapping)) {
+ guardPattern = QVTcoreUtil.getGuardPattern(coreDomain);
+ bottomPattern = QVTcoreUtil.getBottomPattern(coreDomain);
+ guardPatterns.add(guardPattern);
+ bottomPatterns.add(bottomPattern);
+ for (@NonNull Assignment assignment : QVTcoreUtil.getOwnedAssignments(bottomPattern)) {
+ if (assignment instanceof NavigationAssignment) {
+ navigationAssignments.add((NavigationAssignment)assignment);
+ }
+ else if (assignment instanceof VariableAssignment) {
+ VariableAssignment variableAssignment = (VariableAssignment)assignment;
+ addExpression(QVTcoreUtil.getTargetVariable(variableAssignment), QVTcoreUtil.getValue(variableAssignment));
}
}
}
}
+ protected void addExpression(@NonNull VariableDeclaration variable, @NonNull OCLExpression expression) {
+ List<@NonNull OCLExpression> initializers = variable2expressions.get(variable);
+ if (initializers == null) {
+ initializers = new ArrayList<>();
+ variable2expressions.put(variable, initializers);
+ }
+ if (!initializers.contains(expression)) { // Shouldn't really happen but variable.ownedIInit is lazy
+ initializers.add(expression);
+ }
+ }
+
/**
* Create the BLUE/CYAN computations for the RHS of assignments.
*/
@@ -209,28 +239,6 @@ public class MappingAnalysis implements Nameable
}
/**
- * Analyze the initializers to form predicates / computations.
- */
- protected void analyzeInitializers(@NonNull Iterable<@NonNull ? extends CorePattern> corePatterns) {
- for (@NonNull CorePattern corePattern : corePatterns) {
- for (@NonNull Variable variable : ClassUtil.nullFree(corePattern.getVariable())) {
- OCLExpression ownedInit = variable.getOwnedInit();
- if (ownedInit != null) {
- analyzeVariable(variable, ownedInit);
- }
- }
- if (corePattern instanceof BottomPattern) {
- for (@NonNull RealizedVariable realizedVariable : ClassUtil.nullFree(((BottomPattern)corePattern).getRealizedVariable())) {
- OCLExpression ownedInit = realizedVariable.getOwnedInit();
- if (ownedInit != null) {
- analyzeVariable(realizedVariable, ownedInit);
- }
- }
- }
- }
- }
-
- /**
* Analyze the predicates to partition the guard variables into the distinct inputs that are not mutually
* navigable as a consequence of predicate constraints.
* @param bottomPatterns
@@ -248,7 +256,13 @@ public class MappingAnalysis implements Nameable
if (boundExpression instanceof VariableExp) {
OCLExpression referenceExpression = getPredicateComparisonReferenceExpression(conditionExpression);
assert referenceExpression != null;
- analyzeSimplePredicate(((VariableExp)boundExpression).getReferredVariable(), referenceExpression);
+ VariableDeclaration referredVariable = QVTcoreUtil.getReferredVariable(((VariableExp)boundExpression));
+ if (referredVariable instanceof BottomVariable) {
+ addExpression(referredVariable, referenceExpression);
+ }
+ else {
+ analyzeSimplePredicate(referredVariable, referenceExpression);
+ }
}
else if (boundExpression instanceof NullLiteralExp) {
OCLExpression referenceExpression = getPredicateComparisonReferenceExpression(conditionExpression);
@@ -314,10 +328,31 @@ public class MappingAnalysis implements Nameable
}
}
- private @NonNull Node analyzeVariable(@NonNull Variable variable, @NonNull OCLExpression ownedInit) {
- Node initNode = ownedInit.accept(expressionAnalyzer);
- assert initNode != null;
- if ((ownedInit instanceof OperationCallExp) && initNode.isOperation()) {
+ private @Nullable Node analyzeVariable(@NonNull Variable variable, @NonNull List<@NonNull OCLExpression> expressions) {
+ //
+ // Use sonething hard to compute as the initializer that creates an initNode in the hope that other
+ // initilalizers might be easier and optimized as simple navigation edges.
+ //
+ OCLExpression bestInitExpression = null;
+ for (@NonNull OCLExpression initExpression : expressions) {
+ if (initExpression instanceof OperationCallExp ) {
+ OperationCallExp operationCallExp = (OperationCallExp)initExpression;
+ OperationId operationId = operationCallExp.getReferredOperation().getOperationId();
+ if (!PivotUtil.isSameOperation(operationId, OperationId.OCLANY_EQUALS) && !PivotUtil.isSameOperation(operationId, OperationId.OCLANY_NOT_EQUALS)) {
+ bestInitExpression = initExpression;
+ break;
+ }
+ }
+ }
+ if (bestInitExpression == null) {
+ bestInitExpression = (expressions.size() > 0) ? expressions.get(0) : null;
+ }
+ if (bestInitExpression == null) {
+ return null;
+ }
+ Node bestInitNode = bestInitExpression.accept(expressionAnalyzer);
+ assert bestInitNode != null;
+ /* if ((ownedInit instanceof OperationCallExp) && initNode.isOperation()) {
if (QVTbaseUtil.isIdentification(((OperationCallExp)ownedInit).getReferredOperation())) {
Node stepNode = RegionUtil.createRealizedStepNode(mappingRegion, variable);
RegionUtil.createEqualsEdge(initNode, stepNode);
@@ -334,10 +369,18 @@ public class MappingAnalysis implements Nameable
RegionUtil.createEqualsEdge(initNode, stepNode);
initNode = stepNode;
}
+ } */
+ bestInitNode.addTypedElement(variable);
+ mappingRegion.addVariableNode(variable, bestInitNode);
+ for (@NonNull OCLExpression initExpression : expressions) {
+ if (initExpression != bestInitExpression) {
+ // FIXME if the extra init is a navigation we can add a navigation to the bestInitNode
+ Node initNode = bestInitExpression.accept(expressionAnalyzer);
+ assert initNode != null;
+ RegionUtil.createEqualsEdge(bestInitNode, initNode);
+ }
}
- initNode.addTypedElement(variable);
- mappingRegion.addVariableNode(variable, initNode);
- return initNode;
+ return bestInitNode;
}
public @NonNull Node createDependencyHead(@NonNull ClassDatumAnalysis classDatumAnalysis) {
@@ -372,14 +415,14 @@ public class MappingAnalysis implements Nameable
/**
* Return the boundExpression if conditionExpression is of the form
- * <br>"boundVariable = referenceExpression"
- * <br>"referenceExpression = boundVariable".
- * <br>"null = referenceExpression"
- * <br>"referenceExpression = null".
- * <br>"constant-expression = referenceExpression"
- * <br>"referenceExpression = constant-expression".
+ * <br>"variable = referenceExpression" => VariableExp(variable)
+ * <br>"referenceExpression = variable" => VariableExp(variable)
+ * <br>"null = referenceExpression" => NullLiteralExp(null)
+ * <br>"referenceExpression = null" => NullLiteralExp(null)
+ * <br>"constant-expression = referenceExpression" => OCLExpression(constant)
+ * <br>"referenceExpression = constant-expression" => OCLExpression(constant)
*
- * Returns null otherwise.
+ * <br>Returns null otherwise.
*/
private @Nullable OCLExpression getPredicateComparisonBoundExpression(@NonNull OCLExpression conditionExpression) {
if (conditionExpression instanceof OperationCallExp) {
@@ -442,7 +485,11 @@ public class MappingAnalysis implements Nameable
Variable variable = (Variable)variableDeclaration;
OCLExpression ownedInit = variable.getOwnedInit();
if (ownedInit != null) {
- node = analyzeVariable(variable, ownedInit);
+ addExpression(variable, ownedInit);
+ }
+ List<@NonNull OCLExpression> expressions = variable2expressions.get(variable);
+ if (expressions != null) {
+ node = analyzeVariable(variable, expressions);
}
else if (variable.eContainer() instanceof BottomPattern) {
DomainUsage domainUsage = RegionUtil.getScheduleManager(mappingRegion).getDomainUsage(variable);
@@ -489,10 +536,8 @@ public class MappingAnalysis implements Nameable
//
analyzeRealizedVariables(); // FIXME bottom variables too
//
- // Create the initialization/predicate/computation nodes and edges
+ // Create the predicate/computation nodes and edges
//
- analyzeInitializers(guardPatterns);
- analyzeInitializers(bottomPatterns);
analyzePredicates(guardPatterns);
analyzePredicates(bottomPatterns);
analyzeAssignmentValues();
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/QVTm2QVTs.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/QVTm2QVTs.java
index 5acd3a40a..cb5ca8625 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/QVTm2QVTs.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/QVTm2QVTs.java
@@ -53,6 +53,7 @@ import org.eclipse.qvtd.pivot.qvtbase.graphs.GraphMLStringBuilder;
import org.eclipse.qvtd.pivot.qvtcore.Mapping;
import org.eclipse.qvtd.pivot.qvtcore.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtcore.analysis.RootDomainUsageAnalysis;
+import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcoreUtil;
import org.eclipse.qvtd.pivot.qvtschedule.ClassDatum;
import org.eclipse.qvtd.pivot.qvtschedule.MappingRegion;
import org.eclipse.qvtd.pivot.qvtschedule.Node;
@@ -60,6 +61,8 @@ import org.eclipse.qvtd.pivot.qvtschedule.OperationRegion;
import org.eclipse.qvtd.pivot.qvtschedule.QVTscheduleFactory;
import org.eclipse.qvtd.pivot.qvtschedule.Region;
import org.eclipse.qvtd.pivot.qvtschedule.impl.OperationRegionImpl;
+import org.eclipse.qvtd.pivot.qvtschedule.utilities.QVTscheduleConstants;
+
import com.google.common.collect.Iterables;
public class QVTm2QVTs extends ScheduleManager
@@ -178,7 +181,7 @@ public class QVTm2QVTs extends ScheduleManager
//
Node resultNode = RegionUtil.createStepNode("result", operationCallExp, dependencyNode, false);
operationRegion.setResultNode(resultNode);
- RegionUtil.createEqualsEdge2(dependencyNode, resultNode);
+ RegionUtil.createExpressionEdge(dependencyNode, QVTscheduleConstants.RETURN_NAME, resultNode);
//
List<Variable> ownedParameters = specification.getOwnedParameters();
List<OCLExpression> ownedArguments = operationCallExp.getOwnedArguments();
@@ -264,7 +267,11 @@ public class QVTm2QVTs extends ScheduleManager
// assert !dependencyNode2.isMatched();
Node nextNode; // FIXME re-use shared paths
if (callExp instanceof NavigationCallExp) {
- nextNode = RegionUtil.createDataTypeNode(dependencyNode2, (NavigationCallExp)callExp);
+ String name = RegionUtil.recoverVariableName(callExp);
+ if (name == null) {
+ name = QVTcoreUtil.getName(QVTcoreUtil.getReferredProperty((NavigationCallExp)callExp));
+ }
+ nextNode = RegionUtil.createDataTypeNode(name, dependencyNode2, (NavigationCallExp)callExp);
}
else {
nextNode = RegionUtil.createDataTypeNode(dependencyNode2, property);
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/RegionUtil.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/RegionUtil.java
index 23ad2d15e..b6055901d 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/RegionUtil.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtm2qvts/RegionUtil.java
@@ -16,6 +16,7 @@ import java.util.List;
import java.util.Map;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.CallExp;
@@ -24,14 +25,19 @@ import org.eclipse.ocl.pivot.CompleteClass;
import org.eclipse.ocl.pivot.DataType;
import org.eclipse.ocl.pivot.IfExp;
import org.eclipse.ocl.pivot.LoopExp;
+import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.NavigationCallExp;
+import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.OperationCallExp;
+import org.eclipse.ocl.pivot.PivotPackage;
import org.eclipse.ocl.pivot.Property;
import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.TypedElement;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.VariableDeclaration;
+import org.eclipse.ocl.pivot.VariableExp;
+import org.eclipse.ocl.pivot.ids.OperationId;
import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.pivot.utilities.StringUtil;
@@ -40,6 +46,8 @@ import org.eclipse.qvtd.compiler.internal.qvts2qvts.ClassDatumAnalysis;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
import org.eclipse.qvtd.pivot.qvtbase.utilities.QVTbaseUtil;
import org.eclipse.qvtd.pivot.qvtcore.NavigationAssignment;
+import org.eclipse.qvtd.pivot.qvtcore.QVTcorePackage;
+import org.eclipse.qvtd.pivot.qvtcore.VariableAssignment;
import org.eclipse.qvtd.pivot.qvtcore.analysis.DomainUsage;
import org.eclipse.qvtd.pivot.qvtcore.utilities.QVTcoreUtil;
import org.eclipse.qvtd.pivot.qvtschedule.CastEdge;
@@ -127,13 +135,13 @@ public class RegionUtil extends QVTscheduleUtil
return createPatternNode(nodeRole, sourceNode, property, sourceNode.isMatched() && isMatched(property));
}
- public static @NonNull Node createDataTypeNode(@NonNull Node sourceNode, @NonNull NavigationCallExp navigationCallExp) {
+ public static @NonNull Node createDataTypeNode(@NonNull String name, @NonNull Node sourceNode, @NonNull NavigationCallExp navigationCallExp) {
Property property = PivotUtil.getReferredProperty(navigationCallExp);
boolean isMatched = sourceNode.isMatched() && isMatched(property);
Role nodeRole = getPatternNodeRole(sourceNode, property);
assert sourceNode.isClass() || (property.getOpposite() != null); // FIXME review is this relevant?
- String name = property.getName();
- assert name != null;
+ // String name = property.getName();
+ // assert name != null;
Region region = getOwningRegion(sourceNode);
ScheduleManager scheduleManager = getScheduleManager(region);
PatternTypedNode node = QVTscheduleFactory.eINSTANCE.createPatternTypedNode();
@@ -193,12 +201,16 @@ public class RegionUtil extends QVTscheduleUtil
return node;
}
+ //
+ // equals edges seem to be a legacy relic. They are used to equate two nodes that have been carelessly created as distinct. The difficulties
+ // of ensuring that downstream code accommodates the duality far outweight the difficulties of creating a single node in the first place.
+ //
+ // This method is not used by any tests, but one anticipated usage arises if a variable has multiple initializers,
+ // in which case a hard inkitializer such as an operation call is preferred, and then other initializers are
+ // checked as predicates using equals edges.
+ //
public static @NonNull Edge createEqualsEdge(@NonNull Node sourceNode, @NonNull Node targetNode) {
return createExpressionEdge(sourceNode, QVTscheduleConstants.EQUALS_NAME, targetNode);
- // throw new UnsupportedOperationException();
- }
- public static @NonNull Edge createEqualsEdge2(@NonNull Node sourceNode, @NonNull Node targetNode) {
- return createExpressionEdge(sourceNode, QVTscheduleConstants.EQUALS_NAME, targetNode);
}
public static @NonNull Edge createExpressionEdge(@NonNull Node sourceNode, @NonNull String name, @NonNull Node targetNode) {
@@ -638,4 +650,38 @@ public class RegionUtil extends QVTscheduleUtil
return Node.Utility.DEAD;
}
}
+
+ /**
+ * Return the variable name associated with oclExpression, or null if none found.
+ * This enables the user's choice of name to be used for the expression node that implements it.
+ */
+ public static @Nullable String recoverVariableName(@NonNull NamedElement namedElement) {
+ EObject eContainer = namedElement.eContainer();
+ EReference eContainmentFeature = namedElement.eContainmentFeature();
+ if ((eContainmentFeature == PivotPackage.Literals.VARIABLE__OWNED_INIT) && (eContainer instanceof Variable)) {
+ return ((Variable)eContainer).getName();
+ }
+ else if ((eContainmentFeature == QVTcorePackage.Literals.ASSIGNMENT__VALUE) && (eContainer instanceof VariableAssignment)) {
+ return ((VariableAssignment)eContainer).getTargetVariable().getName();
+ }
+ else if ((eContainmentFeature == PivotPackage.Literals.CALL_EXP__OWNED_SOURCE) && (eContainer instanceof OperationCallExp)) {
+ OperationCallExp operationCallExp = (OperationCallExp)eContainer;
+ if (PivotUtil.isSameOperation(operationCallExp.getReferredOperation().getOperationId(), OperationId.OCLANY_EQUALS)) {
+ OCLExpression argument = PivotUtil.getOwnedArgument(operationCallExp, 0);
+ if (argument instanceof VariableExp) {
+ return PivotUtil.getReferredVariable((VariableExp)argument).getName();
+ }
+ }
+ }
+ else if ((eContainmentFeature == PivotPackage.Literals.OPERATION_CALL_EXP__OWNED_ARGUMENTS) && (eContainer instanceof OperationCallExp)) {
+ OperationCallExp operationCallExp = (OperationCallExp)eContainer;
+ if (PivotUtil.isSameOperation(operationCallExp.getReferredOperation().getOperationId(), OperationId.OCLANY_EQUALS)) {
+ OCLExpression source = PivotUtil.getOwnedSource(operationCallExp);
+ if (source instanceof VariableExp) {
+ return PivotUtil.getReferredVariable((VariableExp)source).getName();
+ }
+ }
+ }
+ return null;
+ }
} \ No newline at end of file
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java
index e0be30923..2f748e347 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java
@@ -102,6 +102,7 @@ import org.eclipse.qvtd.pivot.qvtschedule.Node;
import org.eclipse.qvtd.pivot.qvtschedule.NodeConnection;
import org.eclipse.qvtd.pivot.qvtschedule.Region;
import org.eclipse.qvtd.pivot.qvtschedule.Role;
+import org.eclipse.qvtd.pivot.qvtschedule.utilities.QVTscheduleConstants;
import com.google.common.collect.Iterables;
@@ -609,12 +610,16 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
TypedElement oldTypedElement = node.getTypedElements().iterator().next();
assert oldTypedElement != null;
if ((oldTypedElement instanceof Variable) && (((Variable)oldTypedElement).getOwnedInit() == null)) {
- // for (@NonNull Edge edge : node.getIncomingEdges()) {
- // if (edge.isArgument() || edge.isCast()) {
- theVariable = createBottomVariable(node, helper.createNullLiteralExp()); // FIXME is this possible?
- // break;
- // }
- // }
+ for (@NonNull Edge edge : RegionUtil.getIncomingEdges(node)) {
+ if (edge.isExpression() && QVTscheduleConstants.EQUALS_NAME.equals(edge.getName())) {
+ Node edgeSource = edge.getEdgeSource();
+ return create(edgeSource); //createBottomVariable(node, helper.createNullLiteralExp()); // FIXME is this possible?
+ }
+ else if (edge.isCast()) {
+ throw new UnsupportedOperationException();
+ //theVariable = createBottomVariable(node, helper.createNullLiteralExp()); // FIXME is this possible?
+ }
+ }
}
else {
return oldTypedElement.accept(this);
@@ -1282,17 +1287,22 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
private void createRealizedVariables() {
for (@NonNull Node newNode : region.getNewNodes()) {
- if (newNode.isPattern() && newNode.isClass()) {
+ if (/*newNode.isPattern() &&*/ newNode.isClass()) {
ExpressionCreator expressionCreator = new ExpressionCreator();
OCLExpression constructor = null;
- for (@NonNull Edge edge : RegionUtil.getIncomingEdges(newNode)) {
- if (edge.isExpression()) {
- Node sourceNode = edge.getEdgeSource();
- if (sourceNode.isOperation()) {
- constructor = ((OperationCallExp)sourceNode.getTypedElements().iterator().next()).accept(expressionCreator);
+ if (newNode.isOperation()) {
+ constructor = ((OperationCallExp)newNode.getTypedElements().iterator().next()).accept(expressionCreator);
+ }
+ /* else {
+ for (@NonNull Edge edge : RegionUtil.getIncomingEdges(newNode)) {
+ if (edge.isExpression()) {
+ Node sourceNode = edge.getEdgeSource();
+ if (sourceNode.isOperation()) {
+ constructor = ((OperationCallExp)sourceNode.getTypedElements().iterator().next()).accept(expressionCreator);
+ }
}
}
- }
+ } */
ClassDatum classDatum = newNode.getClassDatum();
TypedModel pTypedModel = classDatum.getReferredTypedModel();
ImperativeTypedModel iTypedModel = ClassUtil.nonNullState(visitor.getQVTiTypedModel(pTypedModel));
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/AbstractPartition.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/AbstractPartition.java
index d3b48b3b4..f86ddd453 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/AbstractPartition.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvts/partitioner/AbstractPartition.java
@@ -314,7 +314,7 @@ abstract class AbstractPartition
protected boolean resolveComputations(@NonNull Node targetNode) {
boolean gotIt = false;
- for (@NonNull Edge incomingEdge : RegionUtil.getIncomingEdges(targetNode)) { // Should be just one.
+ for (@NonNull Edge incomingEdge : RegionUtil.getIncomingEdges(targetNode)) {
if (incomingEdge.isComputation() || (incomingEdge.isNavigation() && incomingEdge.isOld())) {
Set<@NonNull Node> sourceNodes = new HashSet<>();
if (isComputable(sourceNodes, incomingEdge)) {
@@ -364,7 +364,7 @@ abstract class AbstractPartition
for (@NonNull NavigableEdge edge : node.getNavigationEdges()) {
if (!partitioner.hasRealizedEdge(edge)) {
Node targetNode = edge.getEdgeTarget();
- if (targetNode.isDataType()) {
+ if (targetNode.isDataType() || targetNode.isOperation()) {
if (resolveComputations(targetNode)) {
if (!hasNode(targetNode)) {
addNode(targetNode, RegionUtil.getNodeRole(targetNode));
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtu2qvtm/QVTu2QVTm.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtu2qvtm/QVTu2QVTm.java
index 565b1d496..2931c5c7a 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtu2qvtm/QVTu2QVTm.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtu2qvtm/QVTu2QVTm.java
@@ -293,7 +293,7 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
return false;
}
- protected void synthesize(@NonNull Area mArea) {
+ protected void synthesize(@NonNull Mapping mMapping, @NonNull Area mArea) {
GuardPattern mGuardPattern = QVTcoreFactory.eINSTANCE.createGuardPattern();
mArea.setGuardPattern(mGuardPattern);
createVisitor.createAll(guardPredicates, mGuardPattern.getPredicate());
@@ -313,7 +313,7 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
synthesizeNavigationAssignments(QVTcoreUtil.Internal.getOwnedAssignmentsList(mBottomPattern));
if (variableName2mergedVariables != null) {
for (@NonNull MergedVariable mergedVariable : variableName2mergedVariables.values()) { // FIXME Change to alphabetical sort
- mergedVariable.synthesize(mArea);
+ mergedVariable.synthesize(mMapping, mArea);
}
}
//
@@ -334,17 +334,17 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
}
}
- private void synthesizeNavigationAssignment(@NonNull List<@NonNull NavigationAssignment> navigationAssignments, @NonNull List<Assignment> uAssignments) {
+ private void synthesizeNavigationAssignment(@NonNull Iterable<@NonNull NavigationAssignment> navigationAssignments, @NonNull List<Assignment> uAssignments) {
for (@NonNull NavigationAssignment navigationAssignment : navigationAssignments) {
uAssignments.add(createVisitor.create(navigationAssignment)); // FIXME merge
// break;
}
}
- private void synthesizeNavigationAssignments(@NonNull List</*@NoonNull*/ Assignment> uAssignments) {
+ private void synthesizeNavigationAssignments(@NonNull List</*@NonNull*/ Assignment> uAssignments) {
LinkedHashMap<@NonNull String, @NonNull List<@NonNull NavigationAssignment>> variableName_property2navigationAssignments2 = variableName_property2navigationAssignments;
if (variableName_property2navigationAssignments2 != null) {
- for (@NonNull List<@NonNull NavigationAssignment> navigationAssignments : variableName_property2navigationAssignments2.values()) { // FIXME Change to alphabetical sort
+ for (@NonNull Iterable<@NonNull NavigationAssignment> navigationAssignments : variableName_property2navigationAssignments2.values()) { // FIXME Change to alphabetical sort
synthesizeNavigationAssignment(navigationAssignments, uAssignments);
}
}
@@ -454,7 +454,7 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
return uExampleDomain.isIsEnforceable(); // FIXME all domains ??
}
- public @NonNull CoreDomain synthesize() {
+ public @NonNull CoreDomain synthesize(@NonNull Mapping mMapping) {
CoreDomain mDomain = QVTcoreFactory.eINSTANCE.createCoreDomain();
// mDomain.setTypedModel(uTypedModel);
mDomain.setName(uTypedModel.getName());
@@ -478,7 +478,7 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
}
mDomain.setIsCheckable(isCheckable);
mDomain.setIsEnforceable(isEnforceable);
- synthesize(mDomain);
+ synthesize(mMapping, mDomain);
return mDomain;
}
@@ -615,12 +615,12 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
public void synthesize(@NonNull Mapping mMapping) {
String name = createVisitor.getContext().getMappingName(uMapping);
mMapping.setName(name);
- super.synthesize(mMapping);
+ super.synthesize(mMapping, mMapping);
Transformation uTransformation = QVTbaseUtil.getContainingTransformation(uMapping);
for (@NonNull TypedModel uTypedModel : QVTbaseUtil.getModelParameters(uTransformation)) {
MergedDomain mergedDomain = uTypedModel2mergedDomain.get(uTypedModel);
if (mergedDomain != null) {
- CoreDomain mDomain = mergedDomain.synthesize();
+ CoreDomain mDomain = mergedDomain.synthesize(mMapping);
mMapping.getDomain().add(mDomain);
}
}
@@ -692,7 +692,7 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
}
}
- public void synthesize(@NonNull Area mArea) {
+ public void synthesize(@NonNull Mapping mMapping, @NonNull Area mArea) {
List<@NonNull VariableAssignment> assignments2 = assignments;
List<@NonNull Variable> variables2 = variables;
if (variables2 != null) {
@@ -722,8 +722,14 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
createVisitor.createAll(uVariable.getOwnedComments(), mVariable.getOwnedComments());
}
if (assignments2 != null) {
- final Variable finalMVariable = mVariable;
- createVisitor.getContext().addUpdater(finalMVariable, new Updater()
+ // final Variable finalMVariable = mVariable;
+ // List<@NonNull VariableAssignment> mAssignments = new ArrayList<>();
+ createVisitor.createAll(assignments2, mMapping.getBottomPattern().getAssignment());
+ // mArea.getBottomPattern().getAssignment().addAll(mAssignments);
+ // for (@NonNull VariableAssignment uVariableAssignment : assignments2) {
+ // createVisitor.getContext().addTrace(uVariableAssignment, finalMVariable);
+ // }
+ /* createVisitor.getContext().addUpdater(finalMVariable, new Updater()
{
@Override
public void update(@NonNull UpdateVisitor updateVisitor) {
@@ -733,7 +739,7 @@ public class QVTu2QVTm extends AbstractQVTc2QVTc
createVisitor.createAll(uVariableAssignment.getOwnedComments(), finalMVariable.getOwnedComments());
}
}
- });
+ }); */
}
}
else {
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/emf-gen/org/eclipse/qvtd/pivot/qvtimperative/impl/NewStatementImpl.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/emf-gen/org/eclipse/qvtd/pivot/qvtimperative/impl/NewStatementImpl.java
index 4c8c521aa..ff46adf12 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/emf-gen/org/eclipse/qvtd/pivot/qvtimperative/impl/NewStatementImpl.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/emf-gen/org/eclipse/qvtd/pivot/qvtimperative/impl/NewStatementImpl.java
@@ -365,22 +365,6 @@ public class NewStatementImpl extends VariableStatementImpl implements NewStatem
* @generated
*/
@Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (isContained: ");
- result.append(isContained);
- result.append(')');
- return result.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTimperativePackage.NEW_STATEMENT__OWNED_EXPRESSION:
@@ -539,4 +523,9 @@ public class NewStatementImpl extends VariableStatementImpl implements NewStatem
return (R) ((QVTimperativeVisitor<?>)visitor).visitNewStatement(this);
}
+ @Override
+ public String toString() {
+ return super.toString();
+ }
+
} //NewStatementImpl
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtschedule/src/org/eclipse/qvtd/pivot/qvtschedule/utilities/QVTscheduleConstants.java b/plugins/org.eclipse.qvtd.pivot.qvtschedule/src/org/eclipse/qvtd/pivot/qvtschedule/utilities/QVTscheduleConstants.java
index 1d5c67417..d09d7523a 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtschedule/src/org/eclipse/qvtd/pivot/qvtschedule/utilities/QVTscheduleConstants.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtschedule/src/org/eclipse/qvtd/pivot/qvtschedule/utilities/QVTscheduleConstants.java
@@ -49,6 +49,7 @@ public class QVTscheduleConstants
public static final @NonNull String IF_THEN_NAME = "«then»";
public static final @NonNull String LOOP_BODY_NAME = "«body»";
public static final @NonNull String LOOP_ITERATOR_NAME = "«iterator»";
+ public static final @NonNull String RETURN_NAME = "«return»";
public static final @NonNull String BINDING_COLOR = "darkorange";
public static final @NonNull String CONSTANT_COLOR = "black";

Back to the top