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

Unified Diff: test/mjsunit/regress/regress-4693.js

Issue 1633743003: Add UseCounters for some nonstandard JavaScript features (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase and reflow comment Created 4 years, 11 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
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/regress/regress-4693.js
diff --git a/test/mjsunit/regress/regress-4693.js b/test/mjsunit/regress/regress-4693.js
index ed832e65da2b2d0b4a0930d11e39ce24f8bf12e9..614596460758e5982115960e4a58ec23da1e6d67 100644
--- a/test/mjsunit/regress/regress-4693.js
+++ b/test/mjsunit/regress/regress-4693.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Flags: --harmony-sloppy-function
+// Flags: --harmony-sloppy-function --nolegacy-const
// In sloppy mode we allow function redeclarations within blocks for webcompat.
(function() {
@@ -27,3 +27,54 @@ assertThrows(`
}
})();
`, SyntaxError);
+
+// Conflicts between let and function still throw
+assertThrows(`
+ (function() {
+ if (true) {
+ let f;
+ function f() { return 2 }
+ }
+ })();
+`, SyntaxError);
+
+assertThrows(`
+ (function() {
+ if (true) {
+ function f() { return 2 }
+ let f;
+ }
+ })();
+`, SyntaxError);
+
+// Conflicts between const and function still throw
+assertThrows(`
+ (function() {
+ if (true) {
+ const f;
+ function f() { return 2 }
+ }
+ })();
+`, SyntaxError);
+
+assertThrows(`
+ (function() {
+ if (true) {
+ function f() { return 2 }
+ const f;
+ }
+ })();
+`, SyntaxError);
+
+// Annex B redefinition semantics still apply with more blocks
+(function() {
+ assertEquals(undefined, f); // Annex B
+ if (true) {
+ assertEquals(undefined, f);
+ { function f() { return 1 } }
+ assertEquals(1, f());
+ { function f() { return 2 } }
+ assertEquals(2, f());
+ }
+ assertEquals(2, f()); // Annex B
+})();
« no previous file with comments | « src/parsing/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698