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

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

Issue 1622723003: Sloppy mode webcompat: allow conflicting function declarations in blocks (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add Annex B checks to test 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') | test/test262/test262.status » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..ed832e65da2b2d0b4a0930d11e39ce24f8bf12e9
--- /dev/null
+++ b/test/mjsunit/regress/regress-4693.js
@@ -0,0 +1,29 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+// Flags: --harmony-sloppy-function
+
+// In sloppy mode we allow function redeclarations within blocks for webcompat.
+(function() {
+ assertEquals(undefined, f); // Annex B
+ if (true) {
+ assertEquals(2, f());
+ function f() { return 1 }
+ assertEquals(2, f());
+ function f() { return 2 }
+ assertEquals(2, f());
+ }
+ assertEquals(2, f()); // Annex B
+})();
+
+// Should still fail in strict mode
+assertThrows(`
+ (function() {
+ "use strict";
+ if (true) {
+ function f() { return 1 }
+ function f() { return 2 }
+ }
+ })();
+`, SyntaxError);
« no previous file with comments | « src/parsing/parser.cc ('k') | test/test262/test262.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698