diff options
author | Ed Willink | 2022-06-19 09:25:02 +0000 |
---|---|---|
committer | Ed Willink | 2022-06-19 09:25:02 +0000 |
commit | a5cf25a1a1da0c925a33375c5c338678c4f70286 (patch) | |
tree | 187e5e0b695847b88cf43583bd9e8744e492c018 | |
parent | e5b5055775a6dd4730b0f7f8bfeb1336027d56e0 (diff) | |
download | org.eclipse.qvtd-ewillink/580139.tar.gz org.eclipse.qvtd-ewillink/580139.tar.xz org.eclipse.qvtd-ewillink/580139.zip |
ok simplifying/regularizing metaClass / TypeExpewillink/580139
3 files changed, 15 insertions, 10 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/usage/AbstractDomainUsageAnalysis.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/usage/AbstractDomainUsageAnalysis.java index c22280c92..68e12c2a9 100644 --- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/usage/AbstractDomainUsageAnalysis.java +++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/usage/AbstractDomainUsageAnalysis.java @@ -784,7 +784,7 @@ public abstract class AbstractDomainUsageAnalysis extends AbstractExtendingPivot public @NonNull DomainUsage visitTypeExp(@NonNull TypeExp object) { Type referredType = object.getReferredType(); DomainUsage usage; - if (referredType instanceof TemplateParameter) { + if (referredType instanceof TemplateParameter) { // XXX Never happens usage = getTypeUsage(referredType); } else { diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTm.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTm.java index e506d33bf..f833203c9 100644 --- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTm.java +++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/OCL2QVTm.java @@ -334,8 +334,9 @@ public class OCL2QVTm { asTypeOpCallExp.setReferredOperation(getOclAnyOclAsTypeOp()); asTypeOpCallExp.setType(shadowExp.getType()); - TypeExp argTypeExp = createTypeExp(shadowExp.getType()); - argTypeExp.setType(getOclMetaClass()); + TypeExp argTypeExp = new PivotHelper(envFact).createTypeExp(shadowExp.getType()); + // TypeExp argTypeExp = createTypeExp(shadowExp.getType()); + // argTypeExp.setType(getOclMetaClass()); asTypeOpCallExp.getOwnedArguments().add(argTypeExp); @@ -516,7 +517,8 @@ public class OCL2QVTm { asTypeOpCallExp.setType(castType); asTypeOpCallExp.setIsSafe(astPropCallExp.isIsSafe()); - TypeExp argTypeExp = createTypeExp(castType); + TypeExp argTypeExp = new PivotHelper(envFact).createTypeExp(castType); + // TypeExp argTypeExp = createTypeExp(castType); asTypeOpCallExp.getOwnedArguments().add(argTypeExp); if (result.contains(exp)) { // if exp is the initial oclExp, the new asTypeOpCallExp will be the new result @@ -688,12 +690,12 @@ public class OCL2QVTm { } // TODO promote to PivotUtil - private TypeExp createTypeExp(Type type) { + /* private TypeExp createTypeExp(Type type) { TypeExp argTypeExp = PivotFactory.eINSTANCE.createTypeExp(); argTypeExp.setReferredType(type); argTypeExp.setType(getOclMetaClass()); return argTypeExp; - } + } */ // To workaround limitation of Bug 495327: Any mapping related to a non-final ast() operation // will include an additional guard to ensure that only strictly instance of (oclTypeOf) the source type @@ -707,7 +709,8 @@ public class OCL2QVTm { org.eclipse.qvtd.pivot.qvtbase.Predicate predicate = QVTbaseFactory.eINSTANCE.createPredicate(); PivotHelper helper = new PivotHelper(envFact); VariableExp sourceExp = helper.createVariableExp(leftVar); - TypeExp argTypeExp = createTypeExp(leftVar.getType()); + TypeExp argTypeExp = new PivotHelper(envFact).createTypeExp(leftVar.getType()); + // TypeExp argTypeExp = createTypeExp(leftVar.getType()); predicate.setConditionExpression(helper.createOperationCallExp(sourceExp, getOclAnyOclIsTypeOfOp(), Collections.singletonList(argTypeExp))); guard.getPredicate().add(predicate); diff --git a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/QVTmModelsMerger.java b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/QVTmModelsMerger.java index baaef242b..3bd89c972 100644 --- a/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/QVTmModelsMerger.java +++ b/plugins/org.eclipse.qvtd.cs2as.compiler/src/org/eclipse/qvtd/cs2as/compiler/internal/QVTmModelsMerger.java @@ -42,6 +42,7 @@ import org.eclipse.ocl.pivot.VariableExp; import org.eclipse.ocl.pivot.utilities.ClassUtil; import org.eclipse.ocl.pivot.utilities.EnvironmentFactory; import org.eclipse.ocl.pivot.utilities.FeatureFilter; +import org.eclipse.ocl.pivot.utilities.PivotHelper; import org.eclipse.qvtd.pivot.qvtbase.Domain; import org.eclipse.qvtd.pivot.qvtbase.Predicate; import org.eclipse.qvtd.pivot.qvtbase.QVTbaseFactory; @@ -297,9 +298,10 @@ public class QVTmModelsMerger { opCallExp.setOwnedSource(source); // We set the argument - TypeExp arg = PivotFactory.eINSTANCE.createTypeExp(); - arg.setType(envF.getStandardLibrary().getClassType()); - arg.setReferredType(refiningType); + TypeExp arg = new PivotHelper(envF).createTypeExp(refiningType); + // TypeExp arg = PivotFactory.eINSTANCE.createTypeExp(); + // arg.setType(envF.getStandardLibrary().getClassType()); + // arg.setReferredType(refiningType); opCallExp.getOwnedArguments().add(arg); return createNotOperation(envF, opCallExp); |