Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-10-15 10:41:27 +0000
committerEd Willink2016-10-30 11:37:51 +0000
commitb0865d3e44ddb56b52af75cbfd74ab42f3337865 (patch)
tree4694f88323b7c56e12300dfcbec47be7cfc3d796
parent3f1c3e90b90696b3ed93a2c6ec68c0f47b61ea9e (diff)
downloadorg.eclipse.qvtd-b0865d3e44ddb56b52af75cbfd74ab42f3337865.tar.gz
org.eclipse.qvtd-b0865d3e44ddb56b52af75cbfd74ab42f3337865.tar.xz
org.eclipse.qvtd-b0865d3e44ddb56b52af75cbfd74ab42f3337865.zip
[500962] Fixes for use of strict
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java12
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvts2qvti/CyclicScheduledRegion2Mapping.java2
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java13
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java10
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java3
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java5
-rw-r--r--plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java9
-rw-r--r--tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti6
8 files changed, 35 insertions, 25 deletions
diff --git a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
index ed0de1690..890ef4202 100644
--- a/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
+++ b/plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java
@@ -1775,12 +1775,12 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
// Emit the mapping call.
//
if (useClass(cgReferredMapping)) {
- if (pMappingCall.isIsInfinite()) {
- js.append("invokeOnce(" + getMappingCtorName(cgReferredMapping) + ", ");
- }
- else {
- js.append("invoke(" + getMappingCtorName(cgReferredMapping) + ", ");
- }
+ // if (pMappingCall.isIsInfinite()) {
+ // js.append("invokeOnce(" + getMappingCtorName(cgReferredMapping) + ", ");
+ // }
+ // else {
+ js.append("invoke(" + getMappingCtorName(cgReferredMapping) + ", ");
+ // }
}
else {
js.append(getMappingName(cgReferredMapping) + "(");
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 61449639d..ea2d5c462 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
@@ -239,7 +239,7 @@ public class CyclicScheduledRegion2Mapping extends AbstractScheduledRegion2Mappi
public @NonNull MappingCall createMappingCall(@NonNull List<@NonNull MappingParameterBinding> mappingParameterBindings) {
MappingCall mappingCall = super.createMappingCall(mappingParameterBindings);
if (!allRecursionsAreUnique) {
- mappingCall.setIsInfinite(true); // FIXME share code
+ mappingCall.getReferredMapping().setIsStrict(true); // FIXME share code
}
return mappingCall;
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
index a8b887487..4d80f3758 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativePrettyPrintVisitor.java
@@ -86,8 +86,11 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
}
@Override
- public Object visitBufferStatement(@NonNull BufferStatement object) {
- return visitVariableDeclaration(object);
+ public Object visitBufferStatement(@NonNull BufferStatement pBuffer) {
+ if (pBuffer.isIsStrict()) {
+ context.append("strict ");
+ }
+ return visitVariableDeclaration(pBuffer);
}
@Override
public Object visitCheckStatement(@NonNull CheckStatement pPredicate) {
@@ -198,6 +201,9 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
@Override
public Object visitMapping(@NonNull Mapping pMapping) {
+ if (pMapping.isIsStrict()) {
+ context.append("strict ");
+ }
context.append("map ");
context.appendName(pMapping);
context.append(" in ");
@@ -216,9 +222,6 @@ public class QVTimperativePrettyPrintVisitor extends QVTbasePrettyPrintVisitor i
@Override
public Object visitMappingCall(@NonNull MappingCall pMappingCall) {
- if (pMappingCall.isIsInfinite()) {
- context.append("infinite ");
- }
context.append(pMappingCall.isIsInstall() ? "install " : pMappingCall.isIsInvoke() ? "invoke " : "call ");
context.appendName(pMappingCall.getReferredMapping());
context.append(" {\n");
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java
index e4abc6c52..f353ae814 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtimperative/src/org/eclipse/qvtd/pivot/qvtimperative/utilities/QVTimperativeToStringVisitor.java
@@ -110,6 +110,9 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
@Override
public @Nullable String visitBufferStatement(@NonNull BufferStatement asVariable) {
+ if (asVariable.isIsStrict()) {
+ context.append("strict ");
+ }
append("buffer ");
appendName(asVariable);
Type type = asVariable.getType();
@@ -226,8 +229,11 @@ public class QVTimperativeToStringVisitor extends QVTbaseToStringVisitor impleme
}
@Override
- public @Nullable String visitMapping(@NonNull Mapping object) {
- appendQualifiedName(object);
+ public @Nullable String visitMapping(@NonNull Mapping asMapping) {
+ // if (asMapping.isIsStrict()) {
+ // context.append("strict ");
+ // }
+ appendQualifiedName(asMapping);
return null;
}
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
index fd5d85aa3..31da6ae8f 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/as2cs/QVTimperativeDeclarationVisitor.java
@@ -399,6 +399,7 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
csVariable.setPivot(asVariable);
csVariable.setOwnedType(createTypeRefCS(asVariable.getType(), null)); //getScope(asVariable)));
csVariable.setOwnedExpression(context.visitDeclaration(ExpCS.class, asVariable.getOwnedExpression()));
+ csVariable.setIsStrict(asVariable.isIsStrict());
return csVariable;
}
@@ -616,6 +617,7 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
refreshOwnedInTransformation(csMapping, asMapping);
context.refreshList(csMapping.getOwnedParameters(), context.visitDeclarations(MappingParameterCS.class, asMapping.getOwnedParameters(), null));
context.refreshList(csMapping.getOwnedStatements(), context.visitDeclarations(StatementCS.class, asMapping.getOwnedStatements(), null));
+ csMapping.setIsStrict(asMapping.isIsStrict());
return csMapping;
}
@@ -624,7 +626,6 @@ public class QVTimperativeDeclarationVisitor extends QVTbaseDeclarationVisitor i
MappingCallCS csMappingCall = context.refreshElement(MappingCallCS.class, QVTimperativeCSPackage.Literals.MAPPING_CALL_CS, asMappingCall);
csMappingCall.setPivot(asMappingCall);
context.refreshList(csMappingCall.getOwnedBindings(), context.visitDeclarations(MappingParameterBindingCS.class, asMappingCall.getBinding(), null));
- csMappingCall.setIsInfinite(asMappingCall.isIsInfinite());
csMappingCall.setIsInstall(asMappingCall.isIsInstall());
csMappingCall.setIsInvoke(asMappingCall.isIsInvoke());
refreshReferredMapping(csMappingCall, asMappingCall);
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java
index ceb7ecf12..d9d48394d 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/cs2as/QVTimperativeCSContainmentVisitor.java
@@ -236,7 +236,8 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
@Override
public Continuation<?> visitBufferStatementCS(@NonNull BufferStatementCS csElement) {
- refreshNamedElement(BufferStatement.class, QVTimperativePackage.Literals.BUFFER_STATEMENT, csElement);
+ BufferStatement pivotElement = refreshNamedElement(BufferStatement.class, QVTimperativePackage.Literals.BUFFER_STATEMENT, csElement);
+ pivotElement.setIsStrict(csElement.isIsStrict());
return null;
}
@@ -290,6 +291,7 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
Mapping pivotElement = refreshNamedElement(Mapping.class, QVTimperativePackage.Literals.MAPPING, csElement);
context.refreshPivotList(MappingParameter.class, pivotElement.getOwnedParameters(), csElement.getOwnedParameters());
context.refreshPivotList(Statement.class, pivotElement.getOwnedStatements(), csElement.getOwnedStatements());
+ pivotElement.setIsStrict(csElement.isIsStrict());
return null;
}
@@ -297,7 +299,6 @@ public class QVTimperativeCSContainmentVisitor extends AbstractQVTimperativeCSCo
public Continuation<?> visitMappingCallCS(@NonNull MappingCallCS csElement) {
@NonNull MappingCall pivotElement = context.refreshModelElement(MappingCall.class, QVTimperativePackage.Literals.MAPPING_CALL, csElement);
context.refreshPivotList(MappingParameterBinding.class, pivotElement.getBinding(), csElement.getOwnedBindings());
- pivotElement.setIsInfinite(csElement.isIsInfinite());
pivotElement.setIsInstall(csElement.isIsInstall());
pivotElement.setIsInvoke(csElement.isIsInvoke());
context.refreshComments(pivotElement, csElement);
diff --git a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
index 1205ebcfc..f673a4426 100644
--- a/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
+++ b/plugins/org.eclipse.qvtd.xtext.qvtimperative/src/org/eclipse/qvtd/xtext/qvtimperative/formatting/QVTimperativeFormatter.java
@@ -97,7 +97,7 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
{
BufferStatementCSElements a = f.getBufferStatementCSAccess();
c.setLinewrap(1).before(a.getGroup());
- c.setNoSpace().before(a.getSemicolonKeyword_4());
+ c.setNoSpace().before(a.getSemicolonKeyword_5());
}
{
CheckStatementCSElements a = f.getCheckStatementCSAccess();
@@ -134,16 +134,15 @@ public class QVTimperativeFormatter extends AbstractEssentialOCLFormatter
{
MappingCSElements a = f.getMappingCSAccess();
c.setLinewrap(2).before(a.getGroup());
- c.setNoSpace().between(a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_9());
- setBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_9());
+ c.setNoSpace().between(a.getLeftCurlyBracketKeyword_5(), a.getRightCurlyBracketKeyword_10());
+ setBraces(c, a.getLeftCurlyBracketKeyword_5(), a.getRightCurlyBracketKeyword_10());
// c.setLinewrap(2).between(a.getDomainsAssignment_5(), a.getDomainsAssignment_5());
// c.setLinewrap(1).before(a.getOwnedDomainsAssignment_5());
}
{
MappingCallCSElements a = f.getMappingCallCSAccess();
c.setLinewrap(1).before(a.getGroup());
- c.setNoLinewrap().after(a.getIsInfiniteInfiniteKeyword_1_0());
- setAppendedBraces(c, a.getLeftCurlyBracketKeyword_4(), a.getRightCurlyBracketKeyword_6());
+ setAppendedBraces(c, a.getLeftCurlyBracketKeyword_3(), a.getRightCurlyBracketKeyword_5());
// c.setIndentation(a.getLeftCurlyBracketKeyword_3(), a.getRightCurlyBracketKeyword_5());
}
{
diff --git a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti
index 651f35185..5f33d2710 100644
--- a/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti
+++ b/tests/org.eclipse.qvtd.xtext.qvtimperative.tests/src/org/eclipse/qvtd/xtext/qvtimperative/tests/KiamaRewrite/KiamaRewrite.qvti
@@ -31,7 +31,7 @@ map __root__ in KiamaRewrite_qvtp_qvtcas
}
}
for loop0 : kiamacs::PlusCS in ji_PlusCS_31 {
- infinite call r__PlusCS {
+ call r__PlusCS {
ji_NumCS appendsTo ji_NumCS1;
ji_PlusCS appendsTo ji_PlusCS1;
_'«head»' iterates loop0;
@@ -242,7 +242,7 @@ map r_TopCS_node in KiamaRewrite_qvtp_qvtcas
add ji_NumCS += _'«child-NumCS»';
}
-map r__PlusCS in KiamaRewrite_qvtp_qvtcas
+strict map r__PlusCS in KiamaRewrite_qvtp_qvtcas
{
append ji_PlusCS : Set(kiamacs::PlusCS);
append ji_NumCS : Set(kiamacs::NumCS);
@@ -262,7 +262,7 @@ map r__PlusCS in KiamaRewrite_qvtp_qvtcas
add _'«new»' += _'«local»'->excludingAll(ji_PlusCS);
add ji_PlusCS += _'«new»';
for loop0 : kiamacs::PlusCS in _'«new»' {
- infinite call r__PlusCS {
+ call r__PlusCS {
ji_NumCS appendsTo ji_NumCS;
ji_PlusCS appendsTo ji_PlusCS;
_'«head»' iterates loop0;

Back to the top