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

Unified Diff: test/cctest/test-parsing.cc

Issue 1632303002: Treat yield expressions as an AssignmentPattern error (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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-base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 03da6fd12415964e9242bca45978f73c7437fdd5..76bf274a05e009cf4ed152a660792a3ea9896bd6 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2368,6 +2368,7 @@ TEST(NoErrorsGenerator) {
TEST(ErrorsYieldGenerator) {
+ // clang-format off
const char* context_data[][2] = {
{ "function * gen() {", "}" },
{ "\"use strict\"; function * gen() {", "}" },
@@ -2408,8 +2409,19 @@ TEST(ErrorsYieldGenerator) {
"yield\n{yield: 42}",
"yield /* comment */\n {yield: 42}",
"yield //comment\n {yield: 42}",
+ // Destructuring binding and assignment are both disallowed
+ "var [yield] = [42];",
+ "var {foo: yield} = {a: 42};",
+ "[yield] = [42];",
+ "({a: yield} = {a: 42});",
+ // Also disallow full yield expressions on LHS
+ "var [yield 24] = [42];",
+ "var {foo: yield 24} = {a: 42};",
+ "[yield 24] = [42];",
+ "({a: yield 24} = {a: 42});",
rossberg 2016/01/26 19:33:09 Maybe add cases for {[yield]: x} = {...}, just to
adamk 2016/01/26 19:39:57 Do you mean for valid parsing of {[yield]: x} (tha
rossberg 2016/01/26 19:56:26 The former.
NULL
};
+ // clang-format on
RunParserSyncTest(context_data, statement_data, kError);
}
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698