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

Unified Diff: test/mjsunit/harmony/block-non-strict-errors.js

Issue 722203006: Disable classes in sloppy mode unless --harmony-sloppy is set (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Introduce harmony-sloppy flag Created 6 years, 1 month 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/harmony/block-non-strict-errors.js
diff --git a/test/mjsunit/harmony/block-non-strict-errors.js b/test/mjsunit/harmony/block-non-strict-errors.js
index de27cd269fc1241b06b77f40b3abcff2809db824..e0da9ba03253cfaae6b5cabe5be5d3e79cfe680f 100644
--- a/test/mjsunit/harmony/block-non-strict-errors.js
+++ b/test/mjsunit/harmony/block-non-strict-errors.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-scoping
+// Flags: --harmony-scoping --harmony-classes
function CheckError(source) {
var exception = null;
@@ -13,7 +13,7 @@ function CheckError(source) {
}
assertNotNull(exception);
assertEquals(
- "Lexical declarations are currently only allowed in strict mode",
+ "Block-scoped declarations (let, const, function, class) not yet supported outside strict mode",
exception.message);
}
@@ -28,6 +28,12 @@ CheckError("function f() { let x = 1; }");
CheckError("for (let x = 1; x < 1; x++) {}");
CheckError("for (let x of []) {}");
CheckError("for (let x in []) {}");
+CheckError("class C {}");
+CheckError("class C extends Array {}");
+CheckError("1, class {};");
arv (Not doing code reviews) 2014/11/19 16:51:04 I assume your intention was to test class expressi
rossberg 2014/11/19 17:23:43 No, the "1," in front causes it to be parsed as a
arv (Not doing code reviews) 2014/11/19 17:43:09 Ooops The 1 was lost in the noise.
+CheckError("1, class extends Array {};");
+CheckError("1, class C {};");
+CheckError("1, class C exends Array {};");
CheckOk("let = 1;");
CheckOk("{ let = 1; }");

Powered by Google App Engine
This is Rietveld 408576698