Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-10-31 17:05:26 +0000
committerEd Willink2016-10-31 17:05:26 +0000
commitbc738d194634ecd84dae484c00022127cb5c2a67 (patch)
tree5b726eabb31fc7aa0a80bdff73265090717c47b5 /plugins
parent2bc90cefc7bcc6da8d206e15e616fff479bd5a8d (diff)
downloadorg.eclipse.qvtd-bc738d194634ecd84dae484c00022127cb5c2a67.tar.gz
org.eclipse.qvtd-bc738d194634ecd84dae484c00022127cb5c2a67.tar.xz
org.eclipse.qvtd-bc738d194634ecd84dae484c00022127cb5c2a67.zip
[506753] Extra guards are not needed by QVTi mappings.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java35
-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/RootRegion2Mapping.java12
3 files changed, 34 insertions, 17 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
index c7efe5f96..70bf47b2c 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/AbstractScheduledRegion2Mapping.java
@@ -129,21 +129,26 @@ public abstract class AbstractScheduledRegion2Mapping extends AbstractRegion2Map
// Mapping calledMapping = calledRegion2Mapping.getMapping();
List<@NonNull MappingParameterBinding> mappingParameterBindings = new ArrayList<>();
for (@NonNull Node calledGuardNode : calledRegion2Mapping.getGuardNodes()) {
- VariableDeclaration guardVariable = calledRegion2Mapping.getGuardVariable(calledGuardNode);
- NodeConnection callingConnection = calledGuardNode.getIncomingPassedConnection();
- assert callingConnection != null;
- ConnectionVariable connectionVariable = connection2variable.get(callingConnection);
- assert connectionVariable != null;
- if (guardVariable instanceof GuardParameter) {
- mappingParameterBindings.add(helper.createGuardParameterBinding((GuardParameter) guardVariable, connectionVariable));
- }
- else {
- mappingParameterBindings.add(helper.createAppendParameterBinding((AppendParameter) guardVariable, connectionVariable));
- }
- for (@NonNull Node callingNode : calledGuardNode.getUsedBindingSources()) {
- if (callingNode.getRegion() == region) {
- OCLExpression sourceExpression = createSelectByKind(callingNode);
- mappingParameterBindings.add(helper.createSimpleParameterBinding((SimpleParameter) guardVariable, sourceExpression));
+ if (!calledGuardNode.isDependency()) {
+ VariableDeclaration guardVariable = calledRegion2Mapping.getGuardVariable(calledGuardNode);
+ NodeConnection callingConnection = calledGuardNode.getIncomingPassedConnection();
+ assert callingConnection != null;
+ ConnectionVariable connectionVariable = connection2variable.get(callingConnection);
+ assert connectionVariable != null;
+ if (guardVariable instanceof AppendParameter) {
+ mappingParameterBindings.add(helper.createAppendParameterBinding((AppendParameter) guardVariable, connectionVariable));
+ }
+ else if (guardVariable instanceof GuardParameter) {
+ mappingParameterBindings.add(helper.createGuardParameterBinding((GuardParameter) guardVariable, connectionVariable));
+ }
+ else {
+ throw new UnsupportedOperationException();
+ /* for (@NonNull Node callingNode : calledGuardNode.getUsedBindingSources()) {
+ if (callingNode.getRegion() == region) {
+ OCLExpression sourceExpression = createSelectByKind(callingNode);
+ mappingParameterBindings.add(helper.createSimpleParameterBinding((SimpleParameter) guardVariable, sourceExpression));
+ }
+ } */
}
}
}
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 ef91efcc4..bcedb689e 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
@@ -847,7 +847,9 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
}
Collections.sort(guardNodes, NameUtil.NAMEABLE_COMPARATOR);
for (@NonNull Node guardNode : guardNodes) {
- createGuardParameter(guardNode);
+ if (!guardNode.isDependency()) {
+ createGuardParameter(guardNode);
+ }
}
//
// Create any connectionVariable guards
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java
index cfd33221c..bd30279a4 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/RootRegion2Mapping.java
@@ -160,7 +160,17 @@ public class RootRegion2Mapping extends AbstractScheduledRegion2Mapping
@Override
protected @NonNull OCLExpression createSelectByKind(@NonNull Node resultNode) {
throw new UnsupportedOperationException();
- /* Variable resultVariable = node2variable.get(resultNode);
+ /*refactored code inlined at call point -- ?? ok, but needs usage analysis
+ OCLExpression initExpression = createObjectsOfKindExpression(resultNode);
+ List<@NonNull Edge> incomingEdges = resultNode.getIncomingEdges();
+ switch (incomingEdges.size()) {
+ case 0: break;
+ case 1: initExpression = getFilteredExpression(initExpression, (NavigableEdge) incomingEdges.get(0)); break;
+ default: assert false;
+ }
+ return initExpression; */
+ /*very old code
+ Variable resultVariable = node2variable.get(resultNode);
if (resultVariable == null) {
OCLExpression asSource = getRootsVariable(resultNode);
CompleteClass sourceCompleteClass = resultNode.getCompleteClass();

Back to the top