diff options
author | Ed Willink | 2022-06-19 09:25:02 +0000 |
---|---|---|
committer | Ed Willink | 2022-06-20 11:28:38 +0000 |
commit | 648dd2f7affa863d3918e05a2252eeda095147bf (patch) | |
tree | d83a8799dfdd2eb40b7d2c6f4e7dd75ff28716bb | |
parent | aac1a594fe6a7e25fe807215bb5028cebc3ac187 (diff) | |
download | org.eclipse.qvtd-648dd2f7affa863d3918e05a2252eeda095147bf.tar.gz org.eclipse.qvtd-648dd2f7affa863d3918e05a2252eeda095147bf.tar.xz org.eclipse.qvtd-648dd2f7affa863d3918e05a2252eeda095147bf.zip |
[496810] Tidy metaClass / TypeExp usage
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 32e93b37e..a38112314 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 47d4bd4b0..4d9169a50 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); |