Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-11-02 16:56:51 +0000
committerEd Willink2016-11-02 16:56:51 +0000
commit25c67f635cc3fc3e44947c0c020ca2a48f8ab6c1 (patch)
tree836b51722eac2fdb557d478df57a12b2a901ef86
parent2ec2f396df79d2966dc211fa8c07ca8a3a427315 (diff)
downloadorg.eclipse.qvtd-25c67f635cc3fc3e44947c0c020ca2a48f8ab6c1.tar.gz
org.eclipse.qvtd-25c67f635cc3fc3e44947c0c020ca2a48f8ab6c1.tar.xz
org.eclipse.qvtd-25c67f635cc3fc3e44947c0c020ca2a48f8ab6c1.zip
[506849] Ensure cached functions are backward referenced
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/java/QVTiCG2JavaVisitor.java19
-rw-r--r--tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java30
2 files changed, 17 insertions, 32 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 789cfca2f..2fe6c68f9 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
@@ -28,6 +28,7 @@ import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.examples.codegen.analyzer.NameManager;
import org.eclipse.ocl.examples.codegen.cgmodel.CGAccumulator;
+import org.eclipse.ocl.examples.codegen.cgmodel.CGCachedOperation;
import org.eclipse.ocl.examples.codegen.cgmodel.CGClass;
import org.eclipse.ocl.examples.codegen.cgmodel.CGCollectionExp;
import org.eclipse.ocl.examples.codegen.cgmodel.CGEcorePropertyCallExp;
@@ -2320,8 +2321,22 @@ public class QVTiCG2JavaVisitor extends CG2JavaVisitor<@NonNull QVTiCodeGenerato
}
doRun(cgTransformation);
for (@NonNull CGOperation cgOperation : ClassUtil.nullFree(cgOperations)) {
- js.append("\n");
- cgOperation.accept(this);
+ if (!(cgOperation instanceof CGCachedOperation)) {
+ js.append("\n");
+ cgOperation.accept(this);
+ }
+ }
+ for (@NonNull CGOperation cgOperation : ClassUtil.nullFree(cgOperations)) {
+ if ((cgOperation instanceof CGCachedOperation) && (((CGCachedOperation)cgOperation).getFinalOperations().size() <= 0)) {
+ js.append("\n");
+ cgOperation.accept(this);
+ }
+ }
+ for (@NonNull CGOperation cgOperation : ClassUtil.nullFree(cgOperations)) {
+ if ((cgOperation instanceof CGCachedOperation) && (((CGCachedOperation)cgOperation).getFinalOperations().size() > 0)) {
+ js.append("\n");
+ cgOperation.accept(this);
+ }
}
for (@NonNull CGMapping cgMapping : ClassUtil.nullFree(cgTransformation.getMappings())) {
js.append("\n");
diff --git a/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java b/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java
index 606f8508d..fcfabc372 100644
--- a/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java
+++ b/tests/org.eclipse.qvtd.cs2as.compiler.tests/src/org/eclipse/qvtd/cs2as/compiler/tests/OCL2QVTiTestCases.java
@@ -279,36 +279,6 @@ public class OCL2QVTiTestCases extends LoadTestCase {
}
@Test
- public void testExample1_CG2() throws Exception {
- // AbstractTransformer.EXCEPTIONS.setState(true);
- // AbstractTransformer.INVOCATIONS.setState(true);
- // DependencyAnalyzer.CALL.setState(true);
- // DependencyAnalyzer.CREATE.setState(true);
- // DependencyAnalyzer.FINISH.setState(true);
- // DependencyAnalyzer.PENDING.setState(true);
- // DependencyAnalyzer.REFINING.setState(true);
- // DependencyAnalyzer.RETURN.setState(true);
- // DependencyAnalyzer.START.setState(true);
- MyQVT myQVT = new MyQVT("example1");
- myQVT.loadGenModels("SourceMM1.genmodel", "TargetMM1.genmodel");
- myQVT.loadEcoreFile("EnvExample1.ecore", example1.target.lookup.EnvironmentPackage.eINSTANCE);
-
- Transformation qvtiTransf = myQVT.executeNewOCL2QVTi_CompilerChain("Source2Target.ocl");
- CS2ASJavaCompilerParameters cgParams = new CS2ASJavaCompilerParametersImpl(
- "example1.target.lookup.util.TargetLookupSolver",
- "example1.target.lookup.util.TargetLookupResult",
- TESTS_GEN_PATH, TESTS_PACKAGE_NAME);
- Class<? extends Transformer> txClass = new CS2ASJavaCompilerImpl().compileTransformation(myQVT, qvtiTransf, cgParams);
- //Class<? extends Transformer> txClass = Source2Target_qvtp_qvtcas.class;
-
-
- myQVT.executeModelsTX_CG(txClass, "model1");
- // myQVT.executeModelsTX_CG(txClass, "model2");
- // myQVT.executeModelsTX_CG(txClass, "model3");
- myQVT.dispose();
- }
-
- @Test
public void testExample1_Interpreted() throws Exception {
testCaseAppender.uninstall(); // Silence Log failures warning that *.ocl has *.ecore rather than http:// references
MyQVT myQVT = new MyQVT("example1");

Back to the top