Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-09-16 08:42:29 +0000
committerEd Willink2016-09-19 11:31:57 +0000
commite8065247fd3f2c5dfb103a401ecd973b07b0b3ca (patch)
tree0b120c34161256d3fc2002c3ba82868bf5310d3a
parente1e3d0530b25bbf803ae91b998fee02b04fd0098 (diff)
downloadorg.eclipse.qvtd-e8065247fd3f2c5dfb103a401ecd973b07b0b3ca.tar.gz
org.eclipse.qvtd-e8065247fd3f2c5dfb103a401ecd973b07b0b3ca.tar.xz
org.eclipse.qvtd-e8065247fd3f2c5dfb103a401ecd973b07b0b3ca.zip
wip see Bugzillaewillink/480194
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java25
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java16
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/IfStatementAttribution.java56
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java2
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/cs2as/QVTcoreCSPreOrderVisitor.java7
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java12
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java20
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/cs2as/QVTrelationCSPreOrderVisitor.java9
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti4
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java8
10 files changed, 109 insertions, 50 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
index a5af26990..1c8043bd6 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java
@@ -621,34 +621,23 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
@Override
public CGNamedElement visitDeclareStatement(@NonNull DeclareStatement asVariable) {
- if (!asVariable.isIsChecked()) {
+ OCLExpression asInit = asVariable.getOwnedInit();
+ if (asInit == null) {
+
+ }
+ else if (!asVariable.isIsChecked()) {
/* CGVariable cgVariable = getVariable(asVariable);
CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
cgVariable.setInit(initValue);
cgVariable.setTypeId(initValue.getTypeId());
cgVariable.setRequired(initValue.isRequired());
return cgVariable; */
- OCLExpression asInit = asVariable.getOwnedInit();
if (asInit != null) {
getBodyBuilder().appendCheckedLetVariable(asVariable, asInit);
}
}
else {
- // CGVariable cgVariable = getVariable(asVariable);
- // CGValuedElement initValue = doVisit(CGValuedElement.class, asVariable.getOwnedInit());
- // cgVariable.setInit(initValue);
- // cgVariable.setTypeId(initValue.getTypeId());
- // cgVariable.setRequired(initValue.isRequired());
- // FIXME predicate
- // return cgVariable;
- // }
- //
- // @Override
- // public @Nullable CGNamedElement visitVariablePredicate(@NonNull VariablePredicate asPredicate) {
- OCLExpression asExpression = asVariable.getOwnedInit();
- assert asExpression != null;
- //
- CGValuedElement cgExpression = doVisit(CGValuedElement.class, asExpression);
+ CGValuedElement cgExpression = doVisit(CGValuedElement.class, asInit);
cgExpression.setName("temp1_" + asVariable.getName());
//
CGFinalVariable cgUncastVariable = CGModelFactory.eINSTANCE.createCGFinalVariable();
@@ -666,7 +655,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
CGIfExp cgPredicate = CGModelFactory.eINSTANCE.createCGIfExp();
cgPredicate.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
cgPredicate.setRequired(true);
- CGConstantExp cgElse = analyzer.createCGConstantExp(asExpression, analyzer.getBoolean(false));
+ CGConstantExp cgElse = analyzer.createCGConstantExp(asInit, analyzer.getBoolean(false));
setAst(cgElse, asVariable);
cgElse.setTypeId(analyzer.getTypeId(TypeId.BOOLEAN));
cgElse.setRequired(true);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
index 6588e6da7..7cefcff5c 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/analysis/AbstractDomainUsageAnalysis.java
@@ -81,6 +81,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.CheckStatement;
import org.eclipse.qvtd.pivot.qvtimperative.ConnectionVariable;
import org.eclipse.qvtd.pivot.qvtimperative.GuardVariable;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeDomain;
+import org.eclipse.qvtd.pivot.qvtimperative.InitializeStatement;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.pivot.qvtimperative.NewStatement;
import org.eclipse.qvtd.pivot.qvtimperative.DeclareStatement;
@@ -463,6 +464,11 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
+ public @NonNull DomainUsage visitGuardVariable(@NonNull GuardVariable object) {
+ return visit(object.getReferredTypedModel());
+ }
+
+ @Override
public @NonNull DomainUsage visitIfExp(@NonNull IfExp object) {
@SuppressWarnings("unused") DomainUsage conditionUsage = visit(object.getOwnedCondition());
DomainUsage thenUsage = visit(object.getOwnedThen());
@@ -471,11 +477,6 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
- public @NonNull DomainUsage visitGuardVariable(@NonNull GuardVariable object) {
- return visit(object.getReferredTypedModel());
- }
-
- @Override
public @NonNull DomainUsage visitImperativeDomain(@NonNull ImperativeDomain object) {
DomainUsage usage = visit(object.getTypedModel());
setUsage(object, usage);
@@ -483,6 +484,11 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingQVTim
}
@Override
+ public @NonNull DomainUsage visitInitializeStatement(@NonNull InitializeStatement object) {
+ return visit(object.getTargetVariable());
+ }
+
+ @Override
public @NonNull DomainUsage visitIterateExp(@NonNull IterateExp object) {
DomainUsage sourceUsage = visit(object.getOwnedSource());
for (Variable iterator : object.getOwnedIterators()) {
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/IfStatementAttribution.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/IfStatementAttribution.java
new file mode 100644
index 000000000..e0668adb5
--- /dev/null
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/attributes/IfStatementAttribution.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Willink Transformations and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * E.D.Willink - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.qvtd.pivot.qvtimperative.attributes;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.ocl.pivot.internal.scoping.AbstractAttribution;
+import org.eclipse.ocl.pivot.internal.scoping.EnvironmentView;
+import org.eclipse.ocl.pivot.internal.scoping.ScopeView;
+import org.eclipse.qvtd.pivot.qvtimperative.IfStatement;
+import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
+import org.eclipse.qvtd.pivot.qvtimperative.Statement;
+import org.eclipse.qvtd.pivot.qvtimperative.VariableStatement;
+
+public class IfStatementAttribution extends AbstractAttribution
+{
+ public static final IfStatementAttribution INSTANCE = new IfStatementAttribution();
+
+ @Override
+ public ScopeView computeLookup(@NonNull EObject target, @NonNull EnvironmentView environmentView, @NonNull ScopeView scopeView) {
+ IfStatement ifStatement = (IfStatement)target;
+ EStructuralFeature containmentFeature = scopeView.getContainmentFeature();
+ if (containmentFeature == QVTimperativePackage.Literals.IF_STATEMENT__OWNED_THEN_STATEMENTS) {
+ EObject child = scopeView.getChild();
+ for (Statement asStatement : ifStatement.getOwnedThenStatements()) {
+ if (asStatement == child) {
+ break;
+ }
+ if (asStatement instanceof VariableStatement) {
+ environmentView.addNamedElement(asStatement);
+ }
+ }
+ }
+ else if (containmentFeature == QVTimperativePackage.Literals.IF_STATEMENT__OWNED_ELSE_STATEMENTS) {
+ EObject child = scopeView.getChild();
+ for (Statement asStatement : ifStatement.getOwnedElseStatements()) {
+ if (asStatement == child) {
+ break;
+ }
+ if (asStatement instanceof VariableStatement) {
+ environmentView.addNamedElement(asStatement);
+ }
+ }
+ }
+ return scopeView.getParent();
+ }
+}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
index c28caf555..ad1dc042c 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/scoping/QVTimperativePivotScoping.java
@@ -18,6 +18,7 @@ import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.AccessStatementAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.CoreDomainAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.GuardVariableAttribution;
+import org.eclipse.qvtd.pivot.qvtimperative.attributes.IfStatementAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingCallBindingAttribution;
import org.eclipse.qvtd.pivot.qvtimperative.attributes.MappingLoopAttribution;
@@ -29,6 +30,7 @@ public class QVTimperativePivotScoping
Map<EClassifier, Attribution> registry = Attribution.REGISTRY;
registry.put(QVTimperativePackage.Literals.ACCESS_STATEMENT, AccessStatementAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.GUARD_VARIABLE, GuardVariableAttribution.INSTANCE);
+ registry.put(QVTimperativePackage.Literals.IF_STATEMENT, IfStatementAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.IMPERATIVE_DOMAIN, CoreDomainAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING, MappingAttribution.INSTANCE);
registry.put(QVTimperativePackage.Literals.MAPPING_CALL_BINDING, MappingCallBindingAttribution.INSTANCE);
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/cs2as/QVTcoreCSPreOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/cs2as/QVTcoreCSPreOrderVisitor.java
index a59a1f8c9..e78168958 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/cs2as/QVTcoreCSPreOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtcore/src/org/eclipse/qvtd/xtext/qvtcore/cs2as/QVTcoreCSPreOrderVisitor.java
@@ -19,7 +19,6 @@ import org.eclipse.ocl.pivot.utilities.PivotUtil;
import org.eclipse.ocl.xtext.base.cs2as.BasicContinuation;
import org.eclipse.ocl.xtext.base.cs2as.CS2ASConversion;
import org.eclipse.ocl.xtext.base.cs2as.Continuation;
-import org.eclipse.ocl.xtext.base.cs2as.PivotDependency;
import org.eclipse.ocl.xtext.base.cs2as.SingleContinuation;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
@@ -45,7 +44,7 @@ public class QVTcoreCSPreOrderVisitor extends AbstractQVTcoreCSPreOrderVisitor
public static class ParamDeclarationCompletion extends SingleContinuation<ParamDeclarationCS>
{
public ParamDeclarationCompletion(@NonNull CS2ASConversion context, @NonNull ParamDeclarationCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -61,7 +60,7 @@ public class QVTcoreCSPreOrderVisitor extends AbstractQVTcoreCSPreOrderVisitor
public static class QueryCompletion extends SingleContinuation<QueryCS>
{
public QueryCompletion(@NonNull CS2ASConversion context, @NonNull QueryCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -77,7 +76,7 @@ public class QVTcoreCSPreOrderVisitor extends AbstractQVTcoreCSPreOrderVisitor
public static class RealizeableVariableCompletion extends SingleContinuation<RealizeableVariableCS>
{
public RealizeableVariableCompletion(@NonNull CS2ASConversion context, @NonNull RealizeableVariableCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
index a6d6a0003..409d76def 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPostOrderVisitor.java
@@ -160,6 +160,9 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
if (expression != null) {
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
asVariable.setOwnedInit(target);
+ if ((csElement.getOwnedType() == null) && (target != null)) {
+ context.setType(asVariable, target.getType(), target.isIsRequired(), target.getTypeValue());
+ }
}
}
return null;
@@ -228,12 +231,15 @@ public class QVTimperativeCSPostOrderVisitor extends AbstractQVTimperativeCSPost
@Override
public Continuation<?> visitInitializeStatementCS(@NonNull InitializeStatementCS csElement) {
- InitializeStatement asVariable = PivotUtil.getPivot(InitializeStatement.class, csElement);
- if (asVariable != null) {
+ InitializeStatement asStatement = PivotUtil.getPivot(InitializeStatement.class, csElement);
+ if (asStatement != null) {
+ VariableDeclaration targetVariable = csElement.getTargetVariable();
+ assert targetVariable != null;
+ asStatement.setTargetVariable(targetVariable);
ExpCS expression = csElement.getOwnedInit();
if (expression != null) {
OCLExpression target = context.visitLeft2Right(OCLExpression.class, expression);
- asVariable.setOwnedInit(target);
+ asStatement.setOwnedInit(target);
}
}
return null;
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
index 8339aee53..12d6a4315 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSPreOrderVisitor.java
@@ -73,7 +73,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class AccessStatementCompletion extends SingleContinuation<@NonNull AccessStatementCS>
{
public AccessStatementCompletion(@NonNull CS2ASConversion context, @NonNull AccessStatementCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -89,7 +89,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class DeclareStatementCompletion extends SingleContinuation<@NonNull DeclareStatementCS>
{
public DeclareStatementCompletion(@NonNull CS2ASConversion context, @NonNull DeclareStatementCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -105,7 +105,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class GuardVariableCompletion extends SingleContinuation<@NonNull GuardVariableCS>
{
public GuardVariableCompletion(@NonNull CS2ASConversion context, @NonNull GuardVariableCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -121,7 +121,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class InoutVariableCompletion extends SingleContinuation<@NonNull InoutVariableCS>
{
public InoutVariableCompletion(@NonNull CS2ASConversion context, @NonNull InoutVariableCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -136,12 +136,12 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class MappingLoopIteratorCompletion extends SingleContinuation<@NonNull MappingLoopCS>
{
- protected static PivotDependency[] computeDependencies(@NonNull MappingLoopCS csElement) {
+ protected static @NonNull PivotDependency @NonNull [] computeDependencies(@NonNull MappingLoopCS csElement) {
VariableCS csIterator = csElement.getOwnedIterator();
if (csIterator != null) {
TypedRefCS ownedType = csIterator.getOwnedType();
if (ownedType != null) {
- return new PivotDependency[]{new PivotDependency(ownedType)};
+ return new @NonNull PivotDependency[]{new PivotDependency(ownedType)};
}
}
return new PivotDependency[0];
@@ -171,7 +171,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class NewStatementCompletion extends SingleContinuation<@NonNull NewStatementCS>
{
public NewStatementCompletion(@NonNull CS2ASConversion context, @NonNull NewStatementCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -187,7 +187,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class OutVariableCompletion extends SingleContinuation<@NonNull OutVariableCS>
{
public OutVariableCompletion(@NonNull CS2ASConversion context, @NonNull OutVariableCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -203,7 +203,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class ParamDeclarationCompletion extends SingleContinuation<@NonNull ParamDeclarationCS>
{
public ParamDeclarationCompletion(@NonNull CS2ASConversion context, @NonNull ParamDeclarationCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -219,7 +219,7 @@ public class QVTimperativeCSPreOrderVisitor extends AbstractQVTimperativeCSPreOr
public static class QueryCompletion extends SingleContinuation<QueryCS>
{
public QueryCompletion(@NonNull CS2ASConversion context, @NonNull QueryCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/cs2as/QVTrelationCSPreOrderVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/cs2as/QVTrelationCSPreOrderVisitor.java
index ee1e28f4f..21518105c 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/cs2as/QVTrelationCSPreOrderVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtrelation/src/org/eclipse/qvtd/xtext/qvtrelation/cs2as/QVTrelationCSPreOrderVisitor.java
@@ -25,7 +25,6 @@ import org.eclipse.ocl.pivot.utilities.Pivotable;
import org.eclipse.ocl.xtext.base.cs2as.BasicContinuation;
import org.eclipse.ocl.xtext.base.cs2as.CS2ASConversion;
import org.eclipse.ocl.xtext.base.cs2as.Continuation;
-import org.eclipse.ocl.xtext.base.cs2as.PivotDependency;
import org.eclipse.ocl.xtext.base.cs2as.SingleContinuation;
import org.eclipse.ocl.xtext.basecs.PathNameCS;
import org.eclipse.ocl.xtext.basecs.TypedRefCS;
@@ -47,11 +46,11 @@ import org.eclipse.qvtd.xtext.qvtrelationcs.TransformationCS;
import org.eclipse.qvtd.xtext.qvtrelationcs.util.AbstractQVTrelationCSPreOrderVisitor;
public class QVTrelationCSPreOrderVisitor extends AbstractQVTrelationCSPreOrderVisitor
-{
+{
public static class CollectionTemplateCompletion extends SingleContinuation<CollectionTemplateCS>
{
public CollectionTemplateCompletion(@NonNull CS2ASConversion context, @NonNull CollectionTemplateCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -124,7 +123,7 @@ public class QVTrelationCSPreOrderVisitor extends AbstractQVTrelationCSPreOrderV
public static class ObjectTemplateCompletion extends SingleContinuation<ObjectTemplateCS>
{
public ObjectTemplateCompletion(@NonNull CS2ASConversion context, @NonNull ObjectTemplateCS csElement) {
- super(context, null, null, csElement, new PivotDependency(csElement.getOwnedType()));
+ super(context, null, null, csElement, createDependencies(csElement.getOwnedType()));
}
@Override
@@ -267,7 +266,7 @@ public class QVTrelationCSPreOrderVisitor extends AbstractQVTrelationCSPreOrderV
Transformation pivotElement = PivotUtil.getPivot(Transformation.class, csElement);
if (pivotElement != null) {
List<org.eclipse.ocl.pivot.Class> superClasses = pivotElement.getSuperClasses();
-// context.refreshList(Type.class, superClasses, csElement.getOwnedSuperType());
+ // context.refreshList(Type.class, superClasses, csElement.getOwnedSuperType());
if (superClasses.isEmpty()) {
org.eclipse.ocl.pivot.Class oclElementType = context.getMetamodelManager().getStandardLibrary().getOclElementType();
pivotElement.getSuperClasses().add(oclElementType);
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti
index 39d189002..c9ddba447 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/Tree2TallTree/Tree2TallTree.qvti
@@ -52,7 +52,9 @@ map MiddleNode2TallNode in Tree2TallTree {
in:tree2talltree node2tallNode : Node2TallNode;
var tallNode_name : String := node2tallNode.name;
var tallNode_children : Set(TallNode) := node2tallNode.children?.tallNode->asSet();
- var tallNode_height : Integer := if node2tallNode.children->notEmpty() then node2tallNode.children.tallNode.height->max() + 1 else 0 endif;
+ var node2tallNode_children := node2tallNode.children;
+ var tallNode_height : Integer;
+ init tallNode_height := if node2tallNode_children->notEmpty() then node2tallNode_children.tallNode.height->max() + 1 else 0 endif;
new:talltree tallNode : TallNode;
emit node2tallNode.tallNode := tallNode;
set tallNode.name := tallNode_name;
diff --git a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java
index 2ea60588a..bf4b44d53 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java
+++ b/tests/org.eclipse.qvtd.xtext.qvtrelation.tests/test-gen/org/eclipse/qvtd/xtext/qvtrelation2/tests/forward2reverse/Forward2Reverse.java
@@ -353,8 +353,8 @@ public class Forward2Reverse extends AbstractTransformer
* var when_Telement2element : PForward2Reverse::Telement2element[1] := forwardTarget.Telement2element;
* var reverseElement : doublylinkedlist::Element[1] := trace.reverseElement;
* var reverseSource : doublylinkedlist::Element[1] := when_Telement2element.reverseElement;
- * set reverseElement.source := reverseSource;
* set trace.reverseSource := reverseSource;
+ * set reverseElement.source := reverseSource;
*
*/
protected boolean MAP_m_Telement2element_Element_46p3(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element forwardTarget) {
@@ -378,8 +378,8 @@ public class Forward2Reverse extends AbstractTransformer
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element reverseElement_0 = Telement2element_0.getReverseElement();
// mapping statements
- reverseElement.setSource(reverseElement_0);
Telement2element.setReverseSource(reverseElement_0);
+ reverseElement.setSource(reverseElement_0);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Telement2element_Element_p3 = ValueUtil.TRUE_VALUE;
raw_when_Telement2element = m_Telement2element_Element_p3;
}
@@ -548,8 +548,8 @@ public class Forward2Reverse extends AbstractTransformer
* var reverseList : doublylinkedlist::DoublyLinkedList[1] := trace.reverseList;
* var when_Telement2element : PForward2Reverse::Telement2element[1] := forwardHead.Telement2element;
* var reverseHead : doublylinkedlist::Element[1] := when_Telement2element.reverseElement;
- * set trace.reverseHead := reverseHead;
* set reverseList.headElement := reverseHead;
+ * set trace.reverseHead := reverseHead;
*
*/
protected boolean MAP_m_Tlist2list_DoublyLinkedList_46p2(final /*@NonInvalid*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.PForward2Reverse.@org.eclipse.jdt.annotation.NonNull Tlist2list trace_2) {
@@ -568,8 +568,8 @@ public class Forward2Reverse extends AbstractTransformer
@SuppressWarnings("null")
final /*@Thrown*/ org.eclipse.qvtd.xtext.qvtrelation.tests.forward2reverse.doublylinkedlist.@org.eclipse.jdt.annotation.NonNull Element reverseElement = Telement2element.getReverseElement();
// mapping statements
- trace_2.setReverseHead(reverseElement);
reverseList.setHeadElement(reverseElement);
+ trace_2.setReverseHead(reverseElement);
final /*@Thrown*/ java.lang.@org.eclipse.jdt.annotation.Nullable Boolean m_Tlist2list_DoublyLinkedList_p2 = ValueUtil.TRUE_VALUE;
raw_when_Telement2element = m_Tlist2list_DoublyLinkedList_p2;
}

Back to the top