diff options
author | Adolfo SBH | 2014-11-18 12:00:06 +0000 |
---|---|---|
committer | Ed Willink | 2014-11-19 09:55:48 +0000 |
commit | daa7f4d1527316b09846a5c688c6168d4a0597b6 (patch) | |
tree | a184e58f4092dba248ab5c921df2d8e1b57eb7eb | |
parent | 868118daa69be1b9d10a9fe23e1425243080498f (diff) | |
download | org.eclipse.ocl-daa7f4d1527316b09846a5c688c6168d4a0597b6.tar.gz org.eclipse.ocl-daa7f4d1527316b09846a5c688c6168d4a0597b6.tar.xz org.eclipse.ocl-daa7f4d1527316b09846a5c688c6168d4a0597b6.zip |
[451924] Skip implicit variables in all navigation expressions
-rw-r--r-- | examples/org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/pivot2cs/EssentialOCLDeclarationVisitor.java | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/examples/org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/pivot2cs/EssentialOCLDeclarationVisitor.java b/examples/org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/pivot2cs/EssentialOCLDeclarationVisitor.java index a081fc130d..09a84222c6 100644 --- a/examples/org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/pivot2cs/EssentialOCLDeclarationVisitor.java +++ b/examples/org.eclipse.ocl.examples.xtext.essentialocl/src/org/eclipse/ocl/examples/xtext/essentialocl/pivot2cs/EssentialOCLDeclarationVisitor.java @@ -214,15 +214,19 @@ public class EssentialOCLDeclarationVisitor extends BaseDeclarationVisitor if (asSource == null) { return csArgument; } - else { - Type asType = asSource.getType(); - NavigationOperatorCS csNavigationOperator = EssentialOCLCSFactory.eINSTANCE.createNavigationOperatorCS(); - csNavigationOperator.setSource(context.visitDeclaration(ExpCS.class, asSource)); - boolean isCollection = (asType instanceof CollectionType) ^ isConverted; - csNavigationOperator.setName(isCollection ? PivotConstants.COLLECTION_NAVIGATION_OPERATOR : PivotConstants.OBJECT_NAVIGATION_OPERATOR); - csNavigationOperator.setArgument(csArgument); - return csNavigationOperator; + if (asSource instanceof VariableExp) { + VariableDeclaration asVariable = ((VariableExp)asSource).getReferredVariable(); + if ((asVariable instanceof Variable) && ((Variable)asVariable).isImplicit()) { // Skip implicit iterator variables + return csArgument; + } } + Type asType = asSource.getType(); + NavigationOperatorCS csNavigationOperator = EssentialOCLCSFactory.eINSTANCE.createNavigationOperatorCS(); + csNavigationOperator.setSource(context.visitDeclaration(ExpCS.class, asSource)); + boolean isCollection = (asType instanceof CollectionType) ^ isConverted; + csNavigationOperator.setName(isCollection ? PivotConstants.COLLECTION_NAVIGATION_OPERATOR : PivotConstants.OBJECT_NAVIGATION_OPERATOR); + csNavigationOperator.setArgument(csArgument); + return csNavigationOperator; } /** @@ -636,12 +640,6 @@ public class EssentialOCLDeclarationVisitor extends BaseDeclarationVisitor asProperty = context.getMetaModelManager().getOclInvalidProperty(); } NameExpCS csNameExp = createNameExpCS(asProperty); - if (asSource instanceof VariableExp) { - VariableDeclaration asVariable = ((VariableExp)asSource).getReferredVariable(); - if ((asVariable instanceof Variable) && ((Variable)asVariable).isImplicit()) { // Skip implicit iterator variables - return csNameExp; - } - } return createNavigationOperatorCS(asSource, csNameExp, false); } |