Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java')
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java32
1 files changed, 16 insertions, 16 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index d9c1525433..7720f6b7c1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -18,12 +18,12 @@ import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.*;
public class ReturnStatement extends Statement {
-
+
public Expression expression;
public SubRoutineStatement[] subroutines;
public LocalVariableBinding saveValueVariable;
public int initStateIndex = -1;
-
+
public ReturnStatement(Expression expression, int sourceStart, int sourceEnd) {
this.sourceStart = sourceStart;
this.sourceEnd = sourceEnd;
@@ -82,7 +82,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
return FlowInfo.DEAD_END;
}
} while ((traversedContext = traversedContext.parent) != null);
-
+
// resize subroutines
if ((this.subroutines != null) && (subCount != this.subroutines.length)) {
System.arraycopy(this.subroutines, 0, (this.subroutines = new SubRoutineStatement[subCount]), 0, subCount);
@@ -101,7 +101,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
}
return FlowInfo.DEAD_END;
}
-
+
/**
* Retrun statement code generation
*
@@ -122,7 +122,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
this.expression.generateCode(currentScope, codeStream, needValue()); // no value needed if non-returning subroutine
generateStoreSaveValueIfNecessary(codeStream);
}
-
+
// generation of code responsible for invoking the finally blocks in sequence
if (this.subroutines != null) {
Object reusableJSRTarget = this.expression == null ? (Object)TypeBinding.VOID : this.expression.reusableJSRTarget();
@@ -145,14 +145,14 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
generateStoreSaveValueIfNecessary(codeStream);
}
// output the suitable return bytecode or wrap the value inside a descriptor for doits
- this.generateReturnBytecode(codeStream);
+ generateReturnBytecode(codeStream);
if (this.saveValueVariable != null) {
codeStream.removeVariable(this.saveValueVariable);
- }
+ }
if (this.initStateIndex != -1) {
codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.initStateIndex);
codeStream.addDefinitelyAssignedVariables(currentScope, this.initStateIndex);
- }
+ }
codeStream.recordPositionsFrom(pc, this.sourceStart);
SubRoutineStatement.reenterAllExceptionHandlers(this.subroutines, -1, codeStream);
}
@@ -172,13 +172,13 @@ public void generateStoreSaveValueIfNecessary(CodeStream codeStream){
}
private boolean needValueStore() {
- return this.expression != null
+ return this.expression != null
&& (this.expression.constant == Constant.NotAConstant || (this.expression.implicitConversion & TypeIds.BOXING)!= 0)
&& !(this.expression instanceof NullLiteral);
}
public boolean needValue() {
- return this.saveValueVariable != null
+ return this.saveValueVariable != null
|| (this.bits & ASTNode.IsSynchronized) != 0
|| ((this.bits & ASTNode.IsAnySubRoutineEscaping) == 0);
}
@@ -199,8 +199,8 @@ public void resolve(BlockScope scope) {
MethodBinding methodBinding;
TypeBinding methodType =
(methodScope.referenceContext instanceof AbstractMethodDeclaration)
- ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null
- ? null
+ ? ((methodBinding = ((AbstractMethodDeclaration) methodScope.referenceContext).binding) == null
+ ? null
: methodBinding.returnType)
: TypeBinding.VOID;
TypeBinding expressionType;
@@ -222,7 +222,7 @@ public void resolve(BlockScope scope) {
scope.problemReporter().attemptToReturnVoidValue(this);
return;
}
- if (methodType == null)
+ if (methodType == null)
return;
if (methodType != expressionType) // must call before computeConversion() and typeMismatchError()
@@ -234,10 +234,10 @@ public void resolve(BlockScope scope) {
if (expressionType.needsUncheckedConversion(methodType)) {
scope.problemReporter().unsafeTypeConversion(this.expression, expressionType, methodType);
}
- if (this.expression instanceof CastExpression
+ if (this.expression instanceof CastExpression
&& (this.expression.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == 0) {
CastExpression.checkNeedForAssignedCast(scope, methodType, (CastExpression) this.expression);
- }
+ }
return;
} else if (scope.isBoxingCompatibleWith(expressionType, methodType)
|| (expressionType.isBaseType() // narrowing then boxing ?
@@ -245,7 +245,7 @@ public void resolve(BlockScope scope) {
&& !methodType.isBaseType()
&& this.expression.isConstantValueOfTypeAssignableToType(expressionType, scope.environment().computeBoxingType(methodType)))) {
this.expression.computeConversion(scope, methodType, expressionType);
- if (this.expression instanceof CastExpression
+ if (this.expression instanceof CastExpression
&& (this.expression.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == 0) {
CastExpression.checkNeedForAssignedCast(scope, methodType, (CastExpression) this.expression);
} return;

Back to the top