View | Details | Raw Unified | Return to bug 326950 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java (-6 / +2 lines)
Lines 164-173 Link Here
164
	if (hasThenPart) {
164
	if (hasThenPart) {
165
		BranchLabel falseLabel = null;
165
		BranchLabel falseLabel = null;
166
		// generate boolean condition only if needed
166
		// generate boolean condition only if needed
167
		if (((this.bits & ASTNode.IsElseStatementUnreachable) != 0) ||
167
		if (cst != Constant.NotAConstant && cst.booleanValue() == true) {
168
				(cst != Constant.NotAConstant && cst.booleanValue() == true)) {
169
			// No need to generate if condition statement when we know that only the then action
170
			// will be executed
171
			this.condition.generateCode(currentScope, codeStream, false);
168
			this.condition.generateCode(currentScope, codeStream, false);
172
		} else {
169
		} else {
173
			this.condition.generateOptimizedBoolean(
170
			this.condition.generateOptimizedBoolean(
Lines 206-213 Link Here
206
		}
203
		}
207
	} else if (hasElsePart) {
204
	} else if (hasElsePart) {
208
		// generate boolean condition only if needed
205
		// generate boolean condition only if needed
209
		if (((this.bits & ASTNode.IsThenStatementUnreachable) != 0) ||
206
		if (cst != Constant.NotAConstant && cst.booleanValue() == false) {
210
				(cst != Constant.NotAConstant && cst.booleanValue() == false)) {
211
			// No need to generate if condition statement when we know that only the else action
207
			// No need to generate if condition statement when we know that only the else action
212
			// will be executed
208
			// will be executed
213
			this.condition.generateCode(currentScope, codeStream, false);
209
			this.condition.generateCode(currentScope, codeStream, false);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java (-1 / +2 lines)
Lines 72-78 Link Here
72
// complaintLevel = 0 if was reachable up until now, 1 if fake reachable (deadcode), 2 if fatal unreachable (error)
72
// complaintLevel = 0 if was reachable up until now, 1 if fake reachable (deadcode), 2 if fatal unreachable (error)
73
public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel) {
73
public int complainIfUnreachable(FlowInfo flowInfo, BlockScope scope, int previousComplaintLevel) {
74
	if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
74
	if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0) {
75
		this.bits &= ~ASTNode.IsReachable;
75
		if ((flowInfo.reachMode() & FlowInfo.UNREACHABLE_OR_DEAD) != 0)
76
			this.bits &= ~ASTNode.IsReachable;
76
		if (flowInfo == FlowInfo.DEAD_END) {
77
		if (flowInfo == FlowInfo.DEAD_END) {
77
			if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
78
			if (previousComplaintLevel < COMPLAINED_UNREACHABLE) {
78
				scope.problemReporter().unreachableCode(this);
79
				scope.problemReporter().unreachableCode(this);

Return to bug 326950