Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-08-03 21:53:06 +0000
committerStephan Herrmann2010-08-03 21:53:06 +0000
commit97096944439f21a01c7493272de763e3dda818fa (patch)
treee50b14b29831d2ae018dd3fbfba2f37ac924d4d3 /org.eclipse.jdt.core
parent89703ee4b9da8371bb877f119b81a161c60ca90d (diff)
downloadorg.eclipse.objectteams-97096944439f21a01c7493272de763e3dda818fa.tar.gz
org.eclipse.objectteams-97096944439f21a01c7493272de763e3dda818fa.tar.xz
org.eclipse.objectteams-97096944439f21a01c7493272de763e3dda818fa.zip
Additional fix re Bug 321651 - [compiler][otre] array-translations (lifting/lowering) in nested team not properly translated
-> fix regression in test1129_nestedCallin2().
Diffstat (limited to 'org.eclipse.jdt.core')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java21
1 files changed, 18 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java
index 2d63d79cb..350a44298 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java
@@ -605,14 +605,29 @@ public class CallinImplementor extends MethodMappingImplementor
// return _OT$result;
// $endif
- Statement roleMessageSendStatement = roleMessageSend;
+ Expression roleMessageSendExpression = roleMessageSend;
+
+ if (roleMethodBinding.returnType.isArrayType()) {
+ // if return from role method requires array-lowering, we must determine how to access the team (receiver of lowering-method):
+ TypeBinding returnLeaf = roleMethodBinding.returnType.leafComponentType();
+ findEnclosingTeam:
+ if (returnLeaf.isRole()) {
+ ReferenceBinding returnEnclosing = returnLeaf.enclosingType(); // the team type containing the returned role
+ ReferenceBinding currentType = roleModel.getBinding();
+ while ((currentType = currentType.enclosingType()) != null) // traverse all types accessible as this$<n>
+ if (currentType == returnEnclosing)
+ break findEnclosingTeam; // successful
+ // not found, which means this$<n> is not a suitable receiver for array lowering, must use 'receiver' instead:
+ roleMessageSendExpression = new PotentialLowerExpression(roleMessageSend, wrapperReturnType, receiver);
+ }
+ }
callinBindingDeclaration.resultVar = gen.localVariable(
IOTConstants.RESULT, wrapperReturnType, null);
callinBindingDeclaration.resultVar.type.setBaseclassDecapsulation(DecapsulationState.REPORTED);
statements.add(callinBindingDeclaration.resultVar);
- roleMessageSendStatement = gen.assignment(
+ Statement roleMessageSendStatement = gen.assignment(
gen.singleNameReference(IOTConstants.RESULT),
- new PotentialLowerExpression(roleMessageSend, wrapperReturnType, receiver));
+ roleMessageSendExpression);
TryStatement tryFinally = gen.tryFinally(
new Statement[] {roleMessageSendStatement},
new Statement[] {resetFlag});

Back to the top