Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-11-01 13:48:50 +0000
committerEd Willink2016-11-01 17:12:34 +0000
commit2c5f8b04544fd5fe05d6b4eca2d52021186fe45f (patch)
treec889ea538ee06a47c1bcc286f90d7e19a05ed13c
parentb0e854c6947b26b1d46dd5eadc6d788f47b549b7 (diff)
downloadorg.eclipse.qvtd-2c5f8b04544fd5fe05d6b4eca2d52021186fe45f.tar.gz
org.eclipse.qvtd-2c5f8b04544fd5fe05d6b4eca2d52021186fe45f.tar.xz
org.eclipse.qvtd-2c5f8b04544fd5fe05d6b4eca2d52021186fe45f.zip
[474537] Ensure operation/property returns are specialized0.14.0M3
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/common/AbstractQVTc2QVTc.java16
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java2
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java4
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java3
-rw-r--r--plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java6
5 files changed, 18 insertions, 13 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/common/AbstractQVTc2QVTc.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/common/AbstractQVTc2QVTc.java
index 411dd0b4e..ad678038f 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/common/AbstractQVTc2QVTc.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/common/AbstractQVTc2QVTc.java
@@ -13,6 +13,7 @@ package org.eclipse.qvtd.compiler.internal.common;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,7 +49,6 @@ import org.eclipse.ocl.pivot.utilities.ClassUtil;
import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
import org.eclipse.ocl.pivot.utilities.NameUtil;
import org.eclipse.ocl.pivot.utilities.PivotConstants;
-import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
@@ -377,9 +377,11 @@ public abstract class AbstractQVTc2QVTc
protected static abstract class AbstractUpdateVisitor<@NonNull C extends AbstractQVTc2QVTc> extends AbstractExtendingQVTcoreVisitor<Object, C>
{
private Operation equalsOperation = null;
+ protected final @NonNull QVTcoreHelper helper;
public AbstractUpdateVisitor(@NonNull C context) {
super(context);
+ helper = context.getHelper();
}
/**
@@ -409,11 +411,12 @@ public abstract class AbstractQVTc2QVTc
Property targetProperty = QVTcoreUtil.getTargetProperty(paIn);
assert (slotExpression != null) && (targetProperty != null);
OCLExpression valueExpression = copy(paIn.getValue());
- NavigationCallExp propertyCallExp = context.getHelper().createNavigationCallExp(slotExpression, targetProperty);
+ assert valueExpression != null;
+ NavigationCallExp propertyCallExp = helper.createNavigationCallExp(slotExpression, targetProperty);
context.addTrace(paIn, propertyCallExp);
propertyCallExp.eUnset(PivotPackage.Literals.TYPED_ELEMENT__IS_REQUIRED); // FIXME redundant compatibility
Operation equalsOperation = getEqualsOperation();
- OperationCallExp operationCallExp = PivotUtil.createOperationCallExp(propertyCallExp, equalsOperation, valueExpression);
+ OperationCallExp operationCallExp = helper.createOperationCallExp(propertyCallExp, equalsOperation, Collections.singletonList(valueExpression));
context.addTrace(paIn, operationCallExp);
operationCallExp.setName(equalsOperation.getName()); // FIXME redundant compatibility
pOut.setConditionExpression(operationCallExp);
@@ -431,7 +434,7 @@ public abstract class AbstractQVTc2QVTc
OCLExpression slotExpression = copy(paIn.getSlotExpression());
Property targetProperty = QVTcoreUtil.getTargetProperty(paIn);
assert (slotExpression != null) && (targetProperty != null);
- NavigationCallExp propertyCallExp = context.getHelper().createNavigationCallExp(slotExpression, targetProperty);
+ NavigationCallExp propertyCallExp = helper.createNavigationCallExp(slotExpression, targetProperty);
context.addTrace(paIn, propertyCallExp);
propertyCallExp.eUnset(PivotPackage.Literals.TYPED_ELEMENT__IS_REQUIRED); // FIXME redundant compatibility
vaOut.setValue(propertyCallExp);
@@ -469,7 +472,6 @@ public abstract class AbstractQVTc2QVTc
return eOut;
}
assert (toType.conformsTo(standardLibrary, eType));
- QVTcoreHelper helper = context.getHelper();
return helper.createOperationCallExp(eOut, "oclAsType", helper.createTypeExp(toType));
}
@@ -703,9 +705,9 @@ public abstract class AbstractQVTc2QVTc
}
protected final @NonNull EnvironmentFactory environmentFactory;
+ private final @NonNull QVTcoreHelper helper;
protected final @NonNull AbstractCreateVisitor<@NonNull ?> createVisitor;
protected final @NonNull AbstractUpdateVisitor<@NonNull ?> updateVisitor;
- private final @NonNull QVTcoreHelper helper;
private TypedModel middleTypedModelTarget = null;
/**
@@ -734,9 +736,9 @@ public abstract class AbstractQVTc2QVTc
*/
protected AbstractQVTc2QVTc(@NonNull EnvironmentFactory environmentFactory) {
this.environmentFactory = environmentFactory;
+ this.helper = new QVTcoreHelper(environmentFactory);
this.createVisitor = createCreateVisitor();
this.updateVisitor = createUpdateVisitor();
- this.helper = new QVTcoreHelper(environmentFactory);
}
public void addDebugCopies(@NonNull Map<EObject, EObject> copier) {
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java
index 9249977cc..94d61d9ce 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractRegion2Mapping.java
@@ -124,7 +124,7 @@ public abstract class AbstractRegion2Mapping
throw new UnsupportedOperationException();
}
}
- return PivotUtil.createNavigationCallExp(asSource, asProperty);
+ return helper.createNavigationCallExp(asSource, asProperty);
}
protected void createAppendParameters() {
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 bcedb689e..37e97f214 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
@@ -289,12 +289,12 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
if (edgeRole.isLoaded()) {
OCLExpression source = getExpression(edge.getSource());
if (source != null) {
- return PivotUtil.createNavigationCallExp(source, ((NavigableEdge)edge).getProperty());
+ return helper.createNavigationCallExp(source, ((NavigableEdge)edge).getProperty());
}
}
else if (edgeRole.isPredicated()) {
OCLExpression source = create(edge.getSource());
- return PivotUtil.createNavigationCallExp(source, ((NavigableEdge)edge).getProperty());
+ return helper.createNavigationCallExp(source, ((NavigableEdge)edge).getProperty());
}
}
}
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java
index b1627d4bf..bfe3c8c0a 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java
@@ -11,6 +11,7 @@
package org.eclipse.qvtd.compiler.internal.qvts2qvti;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -305,7 +306,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
Operation operation = visitor.getEnvironmentFactory().getIdResolver().getOperation(operationId);
VariableExp localVariableExp = PivotUtil.createVariableExp(localVariable);
VariableExp resultVariableExp = PivotUtil.createVariableExp(accumulatedVariable);
- OperationCallExp excludingAllCallExp = PivotUtil.createOperationCallExp(localVariableExp, operation, resultVariableExp);
+ OperationCallExp excludingAllCallExp = helper.createOperationCallExp(localVariableExp, operation, Collections.singletonList(resultVariableExp));
excludingAllCallExp.setType(localVariableExp.getType());
excludingAllCallExp.setIsRequired(localVariableExp.isIsRequired());
diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java
index 5da34a936..f58b02d5c 100644
--- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java
+++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTp.java
@@ -58,6 +58,7 @@ import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.VariableExp;
import org.eclipse.ocl.pivot.internal.manager.PivotMetamodelManager;
import org.eclipse.ocl.pivot.utilities.EnvironmentFactory;
+import org.eclipse.ocl.pivot.utilities.PivotHelper;
import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.qvtd.pivot.qvtbase.QVTbaseFactory;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
@@ -637,9 +638,10 @@ public class OCL2QVTp {
Variable leftVar = leftDomain.getGuardPattern().getVariable().get(0);
org.eclipse.qvtd.pivot.qvtbase.Predicate predicate = QVTbaseFactory.eINSTANCE.createPredicate();
- VariableExp sourceExp = PivotUtil.createVariableExp(leftVar);
+ PivotHelper helper = new PivotHelper(envFact);
+ VariableExp sourceExp = helper.createVariableExp(leftVar);
TypeExp argTypeExp = createTypeExp(leftVar.getType());
- predicate.setConditionExpression(PivotUtil.createOperationCallExp(sourceExp, getOclAnyOclIsTypeOfOp(), argTypeExp));
+ predicate.setConditionExpression(helper.createOperationCallExp(sourceExp, getOclAnyOclIsTypeOfOp(), Collections.singletonList(argTypeExp)));
guard.getPredicate().add(predicate);
}

Back to the top