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

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

Issue 1460393003: [es6] Fix parsing of 'yield' in function and generator expressions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/es6/generators-parsing.js » ('j') | 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 70438843f438eef47a90d070f9ea93e472cf50fe..2f4b3b7c4e983179a61a8fa001c797fd1d32ae8d 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -2221,7 +2221,6 @@ TEST(NoErrorsYieldSloppyGeneratorsEnabled) {
"function foo(yield) { }",
"function foo(bar, yield) { }",
"function * yield() { }",
- "(function * yield() { })",
"yield = 1;",
"var foo = yield = 1;",
"yield * 2;",
@@ -2282,6 +2281,23 @@ TEST(ErrorsYieldStrict) {
}
+TEST(ErrorsYieldSloppy) {
+ const char* context_data[][2] = {
+ { "", "" },
+ { "function not_gen() {", "}" },
+ { "(function not_gen() {", "})" },
+ { NULL, NULL }
+ };
+
+ const char* statement_data[] = {
+ "(function * yield() { })",
+ NULL
+ };
+
+ RunParserSyncTest(context_data, statement_data, kError);
+}
+
+
TEST(NoErrorsGenerator) {
const char* context_data[][2] = {
{ "function * gen() {", "}" },
@@ -2305,6 +2321,7 @@ TEST(NoErrorsGenerator) {
"yield 3; yield 4;",
"yield * 3; yield * 4;",
"(function (yield) { })",
+ "(function yield() { })",
"yield { yield: 12 }",
"yield /* comment */ { yield: 12 }",
"yield * \n { yield: 12 }",
@@ -2354,9 +2371,8 @@ TEST(ErrorsYieldGenerator) {
"var foo, yield;",
"try { } catch (yield) { }",
"function yield() { }",
- // The name of the NFE is let-bound in the generator, which does not permit
+ // The name of the NFE is bound in the generator, which does not permit
// yield to be an identifier.
- "(function yield() { })",
"(function * yield() { })",
// Yield isn't valid as a formal parameter for generators.
"function * foo(yield) { }",
« no previous file with comments | « src/preparser.h ('k') | test/mjsunit/es6/generators-parsing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698