Prohibit from eliminating non-local temporary variables
This commit is contained in:
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
var $tmp;
|
||||
|
||||
function test(n) {
|
||||
if (n >= 0) {
|
||||
$tmp = n;
|
||||
}
|
||||
else {
|
||||
$tmp = -n;
|
||||
}
|
||||
var result = $tmp;
|
||||
return result;
|
||||
}
|
||||
|
||||
function box() {
|
||||
var result = test(20);
|
||||
if (result != 20) return "fail1: " + result;
|
||||
|
||||
result = test(-20);
|
||||
if (result != 20) return "fail2: " + result;
|
||||
|
||||
if ($tmp != 20) return "fail3: " + result;
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user