Chromium Code Reviews| Index: test/cctest/test-parsing.cc |
| diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
| index 23a3d2621a8fa78b1ce38d8a8dbbd04f58f6251d..f34315a7f20ccbc24d1e80e414d2f7b989ec4c7d 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,27 @@ 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} = {}) => {}", |
|
wingo
2015/08/24 16:01:47
Perhaps add a pattern for ({a=42})=>{} too? Unles
rossberg
2015/08/24 17:01:41
Done.
|
| 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)); |
| } |