Closed Bug 226517 Opened 21 years ago Closed 21 years ago

Finally is executed before return expression

Categories

(Rhino Graveyard :: Compiler, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Currently Rhino executes finally block before evaluating return expression. For
example, the following test in Rhino shell prints "FAILED" because finally code
will be executed before (return_expression_was_calculated = true) is evaluated.

var ok;

function test() 
{
	
	var return_expression_was_calculated = false;
	try {
		return (return_expression_was_calculated = true);
	} finally {
		ok = return_expression_was_calculated;
	}
}

test();

print(ok ? "OK" : "FAILED")
I will fix it in the scope of bug 225831   	
Assignee: nboyd → igor
Depends on: 225831
Summary: Finally is executed before return expression → Finally is executed before return expression
Fxed as part of bug 225831
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Igor's testcase added to JS testsuite:

      mozilla/js/tests/ecma_3/Statements/regress-226517.js
Verified FIXED.

The above testcase used to fail in both the compiled and interpreted
modes of Rhino. Now it passes in both -
Status: RESOLVED → VERIFIED
Trageting as resolved against 1.5R5
Target Milestone: --- → 1.5R5
You need to log in before you can comment on or make changes to this bug.