Index: test/mjsunit/regress/regress-91120.js |
diff --git a/test/mjsunit/regress/regress-91120.js b/test/mjsunit/regress/regress-91120.js |
index 117acac6cdcfbb3bd2fe28d84df8c547c7c49d42..73f545648aff8ba7bbdc88f42a8897d4f37c9129 100644 |
--- a/test/mjsunit/regress/regress-91120.js |
+++ b/test/mjsunit/regress/regress-91120.js |
@@ -25,24 +25,26 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// We intend that the function declaration for g inside catch is hoisted to |
-// function f's scope. Invoke it before try/catch, in the try block, in the |
-// catch block, after try/catch, and outside f, and verify that it has |
-// access to the proper binding of x. |
+// With ES2015 function hoisting semantics, functions are only "hoisted" out |
+// of blocks by writing their values into var-scoped declarations. Therefore, |
+// they access the catch binding when it syntactically appears so. |
+// This is a potentially breaking change vs the old semantics, which would |
+// return 'function' from g() everywhere. |
+ |
var x = 'global'; |
function f() { |
var x = 'function'; |
- assertEquals('function', g()); |
+ assertEquals(undefined, g); |
try { |
- assertEquals('function', g()); |
+ assertEquals(undefined, g); |
throw 'catch'; |
} catch (x) { |
function g() { return x; } |
- assertEquals('function', g()); |
+ assertEquals('catch', g()); |
} |
- assertEquals('function', g()); |
+ assertEquals('catch', g()); |
return g; |
} |
-assertEquals('function', f()()); |
+assertEquals('catch', f()()); |