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

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

Issue 1585473002: [parser] reject parenthesized patterns as DestructuringAssignmentTargets (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove the extra check Created 4 years, 11 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/parsing/parser-base.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 8261d058c45453a45021411350af08548c2043d8..2c22399c349da2d70d308fe7466d6056509b3e6b 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6960,6 +6960,19 @@ TEST(DestructuringAssignmentPositiveTests) {
"{x: { y = 10 } }",
"[(({ x } = { x: 1 }) => x).a]",
+
+ // v8:4662
+ "{ x: (y) }",
+ "{ x: (y) = [] }",
+ "{ x: (foo.bar) }",
+ "{ x: (foo['bar']) }",
+ "[ ...(a) ]",
+ "[ ...(foo['bar']) ]",
+ "[ ...(foo.bar) ]",
+ "[ (y) ]",
+ "[ (foo.bar) ]",
+ "[ (foo['bar']) ]",
+
NULL};
// clang-format on
static const ParserFlag always_flags[] = {
@@ -7066,6 +7079,23 @@ TEST(DestructuringAssignmentNegativeTests) {
"([a] = [])",
"(([a] = []))",
"(([a]) = [])",
+
+ // v8:4662
+ "{ x: ([y]) }",
+ "{ x: ([y] = []) }",
+ "{ x: ({y}) }",
+ "{ x: ({y} = {}) }",
+ "{ x: (++y) }",
+ "[ (...[a]) ]",
+ "[ ...([a]) ]",
+ "[ ...([a] = [])",
+ "[ ...[ ( [ a ] ) ] ]",
+ "[ ([a]) ]",
+ "[ (...[a]) ]",
+ "[ ([a] = []) ]",
+ "[ (++y) ]",
+ "[ ...(++y) ]",
+
NULL};
// clang-format on
static const ParserFlag always_flags[] = {
@@ -7097,7 +7127,7 @@ TEST(DestructuringAssignmentNegativeTests) {
always_flags, arraysize(always_flags));
// Strict mode errors
- const char* strict_context_data[][2] = {{"'use strict'; ", " = {}"},
+ const char* strict_context_data[][2] = {{"'use strict'; (", " = {})"},
{"'use strict'; for (", " of {}) {}"},
{"'use strict'; for (", " in {}) {}"},
{NULL, NULL}};
@@ -7113,6 +7143,27 @@ TEST(DestructuringAssignmentNegativeTests) {
"[ arguments ]",
"[ eval = 0 ]",
"[ arguments = 0 ]",
+
+ // v8:4662
+ "{ x: (eval) }",
+ "{ x: (arguments) }",
+ "{ x: (eval = 0) }",
+ "{ x: (arguments = 0) }",
+ "{ x: (eval) = 0 }",
+ "{ x: (arguments) = 0 }",
+ "[ (eval) ]",
+ "[ (arguments) ]",
+ "[ (eval = 0) ]",
+ "[ (arguments = 0) ]",
+ "[ (eval) = 0 ]",
+ "[ (arguments) = 0 ]",
+ "[ ...(eval) ]",
+ "[ ...(arguments) ]",
+ "[ ...(eval = 0) ]",
+ "[ ...(arguments = 0) ]",
+ "[ ...(eval) = 0 ]",
+ "[ ...(arguments) = 0 ]",
+
NULL};
RunParserSyncTest(strict_context_data, strict_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698