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

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

Issue 2258313002: [async functions] Disallow 'await' in arrow params inside async functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 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/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 741aaf6a3dcd1fd0c0511c1782df9886045da893..b0dc786132ffffc72ea4f79eb12b331abb5f8a59 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -7803,7 +7803,6 @@ TEST(AsyncAwait) {
"function foo(await) { return await; }",
"function* foo() { var await = 1; return await; }",
"function* foo(await) { return await; }",
- "var f = (await) => await;",
"var f = () => { var await = 1; return await; }",
"var O = { method() { var await = 1; return await; } };",
"var O = { method(await) { return await; } };",
@@ -7835,37 +7834,19 @@ TEST(AsyncAwaitErrors) {
};
const char* error_data[] = {
- "var asyncFn = async function() { var await = 1; };",
- "var asyncFn = async function() { var { await } = 1; };",
- "var asyncFn = async function() { var [ await ] = 1; };",
"var asyncFn = async function await() {};",
"var asyncFn = async () => var await = 'test';",
"var asyncFn = async await => await + 'test';",
"var asyncFn = async function(await) {};",
- "var asyncFn = async function() { return async (await) => {}; }",
"var asyncFn = async (await) => 'test';",
- "var asyncFn = async x => { var await = 1; }",
- "var asyncFn = async x => { var { await } = 1; }",
- "var asyncFn = async x => { var [ await ] = 1; }",
"async function f(await) {}",
- "async function f() { var await = 1; }",
- "async function f() { var { await } = 1; }",
- "async function f() { var [ await ] = 1; }",
"var O = { async method(a, a) {} }",
"var O = { async ['meth' + 'od'](a, a) {} }",
"var O = { async 'method'(a, a) {} }",
"var O = { async 0(a, a) {} }",
- "async function f() { var O = { async [await](a, a) {} } }",
-
- "var asyncFn = async function() { await; }",
- "async function f() { await; }",
- "var O = { async method() { await; } };",
"var f = async() => await;",
- "var f = async() => { await; };",
-
- "async function f() { return {await} }",
"var asyncFn = async function*() {}",
"async function* f() {}",
@@ -7887,11 +7868,6 @@ TEST(AsyncAwaitErrors) {
"var f = async() => ((async(x = await 1) => x)();",
- "var asyncFn = async function() { function await() {} }",
- "var asyncFn = async() => { function await() {} }",
- "var O = { async method() { function await() {} } }",
- "async function foo() { function await() {} }",
-
// Henrique Ferreiro's bug (tm)
"(async function foo1() { } foo2 => 1)",
"(async function foo3() { } () => 1)",
@@ -7976,6 +7952,48 @@ TEST(AsyncAwaitErrors) {
RunParserSyncTest(context_data, formal_parameters_data, kError, NULL, 0,
always_flags, arraysize(always_flags));
+
+ // clang-format off
+ const char* async_body_context_data[][2] = {
+ { "async function f() {", "}" },
+ { "var f = async function() {", "}" },
+ { "var f = async() => {", "}" },
+ { "var O = { async method() {", "} }" },
+ { "'use strict'; async function f() {", "}" },
+ { "'use strict'; var f = async function() {", "}" },
+ { "'use strict'; var f = async() => {", "}" },
+ { "'use strict'; var O = { async method() {", "} }" },
+ { NULL, NULL }
+ };
+
+ const char* async_body_error_data[] = {
+ "var await = 1;",
+ "var { await } = 1;",
+ "var [ await ] = 1;",
+ "return async (await) => {};",
+ "var O = { async [await](a, a) {} }",
+ "await;",
+
+ "function await() {}",
+
+ "var f = await => 42;",
+ "var f = (await) => 42;",
+ "var f = (await, a) => 42;",
+ "var f = (...await) => 42;",
+
+ "var e = (await);",
+ "var e = (await, f);",
+ "var e = (await = 42)",
+
+ "var e = [await];",
+ "var e = {await};",
+
+ NULL
+ };
+ // clang-format on
+
+ RunParserSyncTest(async_body_context_data, async_body_error_data, kError,
+ NULL, 0, always_flags, arraysize(always_flags));
}
TEST(AsyncAwaitModule) {
« 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