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

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

Issue 1309523005: In generators, "yield" cannot be an arrow formal parameter name (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 4 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/preparser.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 19ca85a13bd75649ee1d26297a73a0f4394e10bb..ef18bb737f5c9495e6cde721ce442c949fe062f1 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -3822,6 +3822,50 @@ TEST(ArrowFunctionsSloppyParameterNames) {
}
+TEST(ArrowFunctionsYieldParameterNameInGenerator) {
+ const char* sloppy_function_context_data[][2] = {
+ {"(function f() { (", "); });"},
+ {NULL, NULL}
+ };
+
+ const char* strict_function_context_data[][2] = {
+ {"(function f() {'use strong'; (", "); });"},
+ {"(function f() {'use strict'; (", "); });"},
+ {NULL, NULL}
+ };
+
+ const char* generator_context_data[][2] = {
+ {"(function *g() {'use strong'; (", "); });"},
+ {"(function *g() {'use strict'; (", "); });"},
+ {"(function *g() { (", "); });"},
+ {NULL, NULL}
+ };
+
+ const char* arrow_data[] = {
+ "yield => {}",
+ "(yield) => {}",
+ "(a, yield) => {}",
+ "(yield, a) => {}",
+ "(yield, ...a) => {}",
+ "(a, ...yield) => {}",
+ "({yield}) => {}",
+ "([yield]) => {}",
+ NULL
+ };
+
+ static const ParserFlag always_flags[] = { kAllowHarmonyDestructuring,
+ kAllowHarmonyRestParameters,
+ kAllowHarmonyArrowFunctions,
+ kAllowStrongMode};
+ RunParserSyncTest(sloppy_function_context_data, arrow_data, kSuccess, NULL, 0,
+ always_flags, arraysize(always_flags));
+ RunParserSyncTest(strict_function_context_data, arrow_data, kError, NULL, 0,
+ always_flags, arraysize(always_flags));
+ RunParserSyncTest(generator_context_data, arrow_data, kError, NULL, 0,
+ always_flags, arraysize(always_flags));
+}
+
+
TEST(SuperNoErrors) {
// Tests that parser and preparser accept 'super' keyword in right places.
const char* context_data[][2] = {
« no previous file with comments | « src/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698