-
-
Save szegedi/22d634d70d422445be9a to your computer and use it in GitHub Desktop.
try/finally inlining failures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
print("TEST: for-continue"); | |
var finallyExpected = false; | |
try { | |
for(var i = 0; i < 2; ++i) { | |
if(i == 1) { | |
print("before continue"); | |
continue; | |
} | |
print("after continue"); | |
} | |
print("after for"); | |
finallyExpected = true; | |
} finally { | |
if (!finallyExpected) { | |
print("ERROR: premature finally"); | |
} else { | |
print("finally"); | |
} | |
} | |
print(); | |
})(); | |
(function() { | |
print("TEST: for-break"); | |
var finallyExpected = false; | |
try { | |
for(var i = 0; i < 2; ++i) { | |
if(i == 1) { | |
print("before break"); | |
break; | |
} | |
print("after break"); | |
} | |
print("after for"); | |
finallyExpected = true; | |
} finally { | |
if (!finallyExpected) { | |
print("ERROR: premature finally"); | |
} else { | |
print("finally"); | |
} | |
} | |
print(); | |
})(); | |
(function() { | |
print("TEST: block-break"); | |
var finallyExpected = false; | |
try { | |
L1: { | |
if ((function(){return true})()) { | |
print("before break"); | |
break L1; | |
} | |
print("ERROR: unreachable after break"); | |
} | |
print("after block"); | |
finallyExpected = true; | |
} finally { | |
if (!finallyExpected) { | |
print("ERROR: premature finally"); | |
} else { | |
print("finally"); | |
} | |
} | |
print(); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment