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

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

Issue 1314543005: [es6] Fix default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: These workj 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/parser.cc ('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 23a3d2621a8fa78b1ce38d8a8dbbd04f58f6251d..19ca85a13bd75649ee1d26297a73a0f4394e10bb 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1426,6 +1426,7 @@ enum ParserFlag {
kAllowLazy,
kAllowNatives,
kAllowHarmonyArrowFunctions,
+ kAllowHarmonyDefaultParameters,
kAllowHarmonyRestParameters,
kAllowHarmonySloppy,
kAllowHarmonySloppyLet,
@@ -1451,6 +1452,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser,
parser->set_allow_natives(flags.Contains(kAllowNatives));
parser->set_allow_harmony_arrow_functions(
flags.Contains(kAllowHarmonyArrowFunctions));
+ parser->set_allow_harmony_default_parameters(
+ flags.Contains(kAllowHarmonyDefaultParameters));
parser->set_allow_harmony_rest_parameters(
flags.Contains(kAllowHarmonyRestParameters));
parser->set_allow_harmony_spreadcalls(
@@ -3730,10 +3733,30 @@ TEST(NoErrorsArrowFunctions) {
// Arrow has more precedence, this is the same as: foo ? bar : (baz = {})
"foo ? bar : baz => {}",
+
+ // Arrows with non-simple parameters.
+ "({a}) => {}",
+ "(x = 9) => {}",
+ "(x, y = 9) => {}",
+ "(x = 9, y) => {}",
+ "(x, y = 9, z) => {}",
+ "(x, y = 9, z = 8) => {}",
+ "(...a) => {}",
+ "(x, ...a) => {}",
+ "(x = 9, ...a) => {}",
+ "(x, y = 9, ...a) => {}",
+ "(x, y = 9, {b}, z = 8, ...a) => {}",
+ // TODO(wingo, rossberg): This is not accepted right now.
+ // "({a} = {}) => {}",
+ // "([x] = []) => {}",
+ "({a = 42}) => {}",
+ "([x = 0]) => {}",
NULL
};
- static const ParserFlag always_flags[] = {kAllowHarmonyArrowFunctions};
+ static const ParserFlag always_flags[] = {
+ kAllowHarmonyArrowFunctions, kAllowHarmonyDefaultParameters,
+ kAllowHarmonyRestParameters, kAllowHarmonyDestructuring};
RunParserSyncTest(context_data, statement_data, kSuccess, NULL, 0,
always_flags, arraysize(always_flags));
}
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698