Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1344)

Unified Diff: test/mjsunit/es6/block-sloppy-function.js

Issue 2109733003: Add errors for declarations which conflict with catch parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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; }
{

Powered by Google App Engine
This is Rietveld 408576698