Index: test/mjsunit/es6/block-sloppy-function.js |
diff --git a/test/mjsunit/es6/block-sloppy-function.js b/test/mjsunit/es6/block-sloppy-function.js |
index 41063b4618af509b1d15d3922df0c0a7dc5af126..aae86f72ef24ab8c8286337f0efd10945e6ccb84 100644 |
--- a/test/mjsunit/es6/block-sloppy-function.js |
+++ b/test/mjsunit/es6/block-sloppy-function.js |
@@ -191,6 +191,45 @@ assertThrows(function notInDefaultScope(x = y) { |
assertEquals(x, undefined); |
}, ReferenceError); |
+// B.3.5 interacts with B.3.3 to allow this. |
+(function hoistingThroughSimpleCatch() { |
+ assertEquals(undefined, f); |
+ |
+ try { |
+ throw 0; |
+ } catch(f) { |
+ { |
+ assertEquals(4, f()); |
+ |
+ function f() { |
+ return 4; |
+ } |
+ |
+ assertEquals(4, f()); |
+ } |
+ } |
+ |
+ assertEquals(4, f()); |
+})(); |
+ |
+(function noHoistingThroughComplexCatch() { |
+ try { |
+ throw 0; |
+ } catch({f}) { |
+ { |
+ assertEquals(4, f()); |
+ |
+ function f() { |
+ return 4; |
+ } |
+ |
+ assertEquals(4, f()); |
+ } |
+ } |
+ |
+ assertThrows(()=>f, ReferenceError); |
+})(); |
+ |
// Test that hoisting from blocks does happen in global scope |
function globalHoisted() { return 0; } |
{ |