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

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

Issue 2290753003: Allow lexically declared "arguments" in function scope in sloppy mode. (Closed)
Patch Set: clang format Created 4 years, 3 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 | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/mjsunit/bugs/bug-4577.js » ('j') | 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 befa92a5a1d0e5d953e4d9f024eb8ef15f4627fd..383d372770b9314e491038544fdaa1b963bfb735 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -6444,10 +6444,9 @@ TEST(DestructuringPositiveTests) {
RunParserSyncTest(context_data, data, kSuccess);
// v8:5201
- // TODO(lpy): The two test sets below should be merged once
- // we fix https://bugs.chromium.org/p/v8/issues/detail?id=4577
{
- const char* sloppy_context_data1[][2] = {
+ // clang-format off
+ const char* sloppy_context_data[][2] = {
{"var ", " = {};"},
{"function f(", ") {}"},
{"function f(argument1, ", ") {}"},
@@ -6456,26 +6455,17 @@ TEST(DestructuringPositiveTests) {
{"try {} catch(", ") {}"},
{NULL, NULL}
};
- const char* data1[] = {
+ const char* data[] = {
+ "{arguments}",
"{eval}",
+ "{x: arguments}",
"{x: eval}",
+ "{arguments = false}",
"{eval = false}",
NULL
};
- RunParserSyncTest(sloppy_context_data1, data1, kSuccess);
-
- const char* sloppy_context_data2[][2] = {
- {"var ", " = {};"},
- {"try {} catch(", ") {}"},
- {NULL, NULL}
- };
- const char* data2[] = {
- "{arguments}",
- "{x: arguments}",
- "{arguments = false}",
- NULL,
- };
- RunParserSyncTest(sloppy_context_data2, data2, kSuccess);
+ // clang-format on
+ RunParserSyncTest(sloppy_context_data, data, kSuccess);
}
}
@@ -8330,3 +8320,38 @@ TEST(TrailingCommasInParametersErrors) {
RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags,
arraysize(always_flags));
}
+
+TEST(ArgumentsRedeclaration) {
+ {
+ // clang-format off
+ const char* context_data[][2] = {
+ { "function f(", ") {}" },
+ { NULL, NULL }
+ };
+ const char* success_data[] = {
+ "{arguments}",
+ "{arguments = false}",
+ "arg1, arguments",
+ "arg1, ...arguments",
+ NULL
+ };
+ // clang-format on
+ RunParserSyncTest(context_data, success_data, kSuccess);
+ }
+
+ {
+ // clang-format off
+ const char* context_data[][2] = {
+ { "function f() {", "}" },
+ { NULL, NULL }
+ };
+ const char* data[] = {
+ "const arguments = 1",
+ "let arguments",
+ "var arguments",
+ NULL
+ };
+ // clang-format on
+ RunParserSyncTest(context_data, data, kSuccess);
+ }
+}
« no previous file with comments | « test/cctest/interpreter/test-bytecode-generator.cc ('k') | test/mjsunit/bugs/bug-4577.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698