Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2015-05-07 16:28:50 +0000
committerEd Willink2015-05-07 20:24:17 +0000
commitd3d629f813de32b883e1a6f833a62a2f9e0e98c9 (patch)
tree97698047956410cde9088c00ad4f4be61a2df602
parentb0359e2b523e2dc555752e6b09ebda851d32d64f (diff)
downloadorg.eclipse.qvtd-d3d629f813de32b883e1a6f833a62a2f9e0e98c9.tar.gz
org.eclipse.qvtd-d3d629f813de32b883e1a6f833a62a2f9e0e98c9.tar.xz
org.eclipse.qvtd-d3d629f813de32b883e1a6f833a62a2f9e0e98c9.zip
[unrelated] Resolve complete types for RealizedVariables
-rw-r--r--plugins/org.eclipse.qvtd.codegen/src/org/eclipse/qvtd/codegen/qvti/analyzer/QVTiAS2CGVisitor.java19
1 files changed, 17 insertions, 2 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 70aef2ddd..e3aa96182 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
@@ -18,6 +18,7 @@ import java.util.List;
import java.util.Set;
import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -33,6 +34,7 @@ import org.eclipse.ocl.examples.codegen.cgmodel.CGVariable;
import org.eclipse.ocl.examples.codegen.generator.GenModelException;
import org.eclipse.ocl.examples.codegen.java.JavaLocalContext;
import org.eclipse.ocl.pivot.CollectionType;
+import org.eclipse.ocl.pivot.CompleteClass;
import org.eclipse.ocl.pivot.ExpressionInOCL;
import org.eclipse.ocl.pivot.Import;
import org.eclipse.ocl.pivot.Iteration;
@@ -333,6 +335,20 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
return cgPropertyCallExp;
}
+ protected @Nullable EClassifier getEClassifier(@Nullable Type type) {
+ if (type == null) {
+ return null;
+ }
+ CompleteClass completeClass = environmentFactory.getCompleteModel().getCompleteClass(type);
+ for (Type partialClass : completeClass.getPartialClasses()) {
+ EObject esObject = partialClass.getESObject();
+ if (esObject instanceof EClassifier) {
+ return (EClassifier) esObject;
+ }
+ }
+ return null;
+ }
+
public @NonNull CGFunctionParameter getFunctionParameter(@NonNull FunctionParameter asFunctionParameter) {
CGFunctionParameter cgFunctionParameter = (CGFunctionParameter)getVariablesStack().getParameter(asFunctionParameter);
if (cgFunctionParameter == null) {
@@ -360,8 +376,7 @@ public class QVTiAS2CGVisitor extends AS2CGVisitor implements QVTimperativeVisit
Variables variablesStack = getVariablesStack();
CGRealizedVariable cgVariable = (CGRealizedVariable) variablesStack.getVariable(pRealizedVariable);
if (cgVariable == null) {
- Type pivotType = ClassUtil.nonNullModel(pRealizedVariable.getType());
- EClassifier eClassifier = (EClassifier) pivotType.getESObject();
+ EClassifier eClassifier = getEClassifier(pRealizedVariable.getType());
if (eClassifier != null) {
CGEcoreRealizedVariable cgEcoreRealizedVariable = QVTiCGModelFactory.eINSTANCE.createCGEcoreRealizedVariable();
cgEcoreRealizedVariable.setEClassifier(eClassifier);

Back to the top