Index: test/cctest/test-parsing.cc |
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc |
index 44acc1c37ea53ac3deee958cd06af960c6984eff..98a27c0327253806da29176adcc8bbb5c0eed12d 100644 |
--- a/test/cctest/test-parsing.cc |
+++ b/test/cctest/test-parsing.cc |
@@ -6712,6 +6712,9 @@ TEST(StrongModeFreeVariablesNotDeclared) { |
} |
} |
+static const ParserFlag kAllDestructuringFlags[] = { |
+ kAllowHarmonyDestructuring, kAllowHarmonyDestructuringAssignment, |
+ kAllowHarmonyDefaultParameters}; |
TEST(DestructuringPositiveTests) { |
i::FLAG_harmony_destructuring_bind = true; |
@@ -6769,6 +6772,8 @@ TEST(DestructuringPositiveTests) { |
static const ParserFlag always_flags[] = {kAllowHarmonyDestructuring}; |
RunParserSyncTest(context_data, data, kSuccess, NULL, 0, always_flags, |
arraysize(always_flags)); |
+ RunParserSyncTest(context_data, data, kSuccess, NULL, 0, |
+ kAllDestructuringFlags, arraysize(kAllDestructuringFlags)); |
} |
@@ -6846,6 +6851,10 @@ TEST(DestructuringNegativeTests) { |
"[...rest,...rest1]", |
"[a,b,...rest,...rest1]", |
"[a,,..rest,...rest1]", |
+ "[x, y, ...z = 1]", |
+ "[...z = 1]", |
+ "[x, y, ...[z] = [1]]", |
+ "[...[z] = [1]]", |
"{ x : 3 }", |
"{ x : 'foo' }", |
"{ x : /foo/ }", |
@@ -6858,6 +6867,9 @@ TEST(DestructuringNegativeTests) { |
// clang-format on |
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
arraysize(always_flags)); |
+ RunParserSyncTest(context_data, data, kError, NULL, 0, |
+ kAllDestructuringFlags, |
+ arraysize(kAllDestructuringFlags)); |
} |
{ // All modes. |
@@ -6878,6 +6890,9 @@ TEST(DestructuringNegativeTests) { |
// clang-format on |
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
arraysize(always_flags)); |
+ RunParserSyncTest(context_data, data, kError, NULL, 0, |
+ kAllDestructuringFlags, |
+ arraysize(kAllDestructuringFlags)); |
} |
{ // Strict mode. |
@@ -6898,6 +6913,9 @@ TEST(DestructuringNegativeTests) { |
// clang-format on |
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
arraysize(always_flags)); |
+ RunParserSyncTest(context_data, data, kError, NULL, 0, |
+ kAllDestructuringFlags, |
+ arraysize(kAllDestructuringFlags)); |
} |
{ // 'yield' in generators. |
@@ -6916,6 +6934,9 @@ TEST(DestructuringNegativeTests) { |
// clang-format on |
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, |
arraysize(always_flags)); |
+ RunParserSyncTest(context_data, data, kError, NULL, 0, |
+ kAllDestructuringFlags, |
+ arraysize(kAllDestructuringFlags)); |
} |
{ // Declaration-specific errors |
@@ -7202,6 +7223,8 @@ TEST(DestructuringAssignmentNegativeTests) { |
"[...x,]", |
"[x, y, ...z = 1]", |
"[...z = 1]", |
+ "[x, y, ...[z] = [1]]", |
+ "[...[z] = [1]]", |
// v8:4657 |
"({ x: x4, x: (x+=1e4) })", |
@@ -7452,14 +7475,7 @@ TEST(DefaultParametersYieldInInitializers) { |
"x, y=f(yield)", |
"{x=f(yield)}", |
"[x=f(yield)]", |
- NULL |
- }; |
- // TODO(wingo): These aren't really destructuring assignment patterns; we're |
- // just splitting them for now until the parser gets support for arrow |
- // function arguments that look like destructuring assignments. When that |
- // happens we should unify destructuring_assignment_data and parameter_data. |
- const char* destructuring_assignment_data[] = { |
"{x}=yield", |
"[x]=yield", |
@@ -7478,26 +7494,16 @@ TEST(DefaultParametersYieldInInitializers) { |
RunParserSyncTest(sloppy_function_context_data, parameter_data, kSuccess, |
NULL, 0, always_flags, arraysize(always_flags)); |
- RunParserSyncTest(sloppy_function_context_data, destructuring_assignment_data, |
- kSuccess, NULL, 0, always_flags, arraysize(always_flags)); |
RunParserSyncTest(sloppy_arrow_context_data, parameter_data, kSuccess, NULL, |
0, always_flags, arraysize(always_flags)); |
- RunParserSyncTest(sloppy_arrow_context_data, destructuring_assignment_data, |
- kSuccess, NULL, 0, always_flags, arraysize(always_flags)); |
RunParserSyncTest(strict_function_context_data, parameter_data, kError, NULL, |
0, always_flags, arraysize(always_flags)); |
- RunParserSyncTest(strict_function_context_data, destructuring_assignment_data, |
- kError, NULL, 0, always_flags, arraysize(always_flags)); |
RunParserSyncTest(strict_arrow_context_data, parameter_data, kError, NULL, 0, |
always_flags, arraysize(always_flags)); |
- RunParserSyncTest(strict_arrow_context_data, destructuring_assignment_data, |
- kError, NULL, 0, always_flags, arraysize(always_flags)); |
RunParserSyncTest(generator_context_data, parameter_data, kError, NULL, 0, |
always_flags, arraysize(always_flags)); |
- RunParserSyncTest(generator_context_data, destructuring_assignment_data, |
- kError, NULL, 0, always_flags, arraysize(always_flags)); |
} |