Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-05-14 10:26:58 -0400
committerEd Willink2016-05-18 09:17:54 -0400
commit0189593c234fde5c39ab729154136ceeed385317 (patch)
treef50278f2bfee465d8efaf249e6a317c69db7c065
parente631413bcae2533300507ece490b99ec86095a22 (diff)
downloadorg.eclipse.qvtd-0189593c234fde5c39ab729154136ceeed385317.tar.gz
org.eclipse.qvtd-0189593c234fde5c39ab729154136ceeed385317.tar.xz
org.eclipse.qvtd-0189593c234fde5c39ab729154136ceeed385317.zip
[486722] Ensure guards are normally required
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/BasicRegion2Mapping.java11
1 files changed, 9 insertions, 2 deletions
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 a5e03b433..726252bf6 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
@@ -1365,14 +1365,21 @@ public class BasicRegion2Mapping extends AbstractRegion2Mapping
private @NonNull Variable createUnrealizedVariable(@NonNull CorePattern pattern, @NonNull Node node, @Nullable OCLExpression initExpression) {
Type variableType = node.getCompleteClass().getPrimaryClass();
assert variableType != null;
- boolean isRequired = false;
+ boolean isRequired = true;
+ for (@NonNull TypedElement typedElement : node.getTypedElements()) {
+ if (!typedElement.isIsRequired()) {
+ isRequired = false;
+ }
+ }
if (initExpression != null) {
Type initType = initExpression.getType();
assert variableType != null;
if (!initType.conformsTo(visitor.getStandardLibrary(), variableType)) {
initExpression = createOclAsTypeCallExp(initExpression, variableType);
}
- isRequired = initExpression.isIsRequired();
+ if (initExpression.isIsRequired()) {
+ isRequired = true;
+ }
}
Variable variable = PivotUtil.createVariable(getSafeName(node), variableType, isRequired, initExpression);
pattern.getVariable().add(variable);

Back to the top