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

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: correct loop index 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 e5f244774f673942a382c66703865ee33dfe758d..9a854ac272714ed307d2cd264f935508b639080f 100644
--- a/test/mjsunit/es6/block-sloppy-function.js
+++ b/test/mjsunit/es6/block-sloppy-function.js
@@ -455,6 +455,45 @@
assertEquals(4, f());
})();
+// 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