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

Unified Diff: test/mjsunit/harmony/async-function-stacktrace.js

Issue 2235423003: [parser] improve inferred function names for async arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add braces around single-line if stmt 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 | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/async-function-stacktrace.js
diff --git a/test/mjsunit/harmony/async-function-stacktrace.js b/test/mjsunit/harmony/async-function-stacktrace.js
index 921f06350056fd95be13874fff642176d17c0171..5ab20881a668e0b82c2ede89cd44af1135130f8f 100644
--- a/test/mjsunit/harmony/async-function-stacktrace.js
+++ b/test/mjsunit/harmony/async-function-stacktrace.js
@@ -83,12 +83,30 @@ async function runTests() {
try { await reject(); } catch (e) { throw new Error("FAIL"); }
} }).c4, ["c4"]);
- // TODO(caitp): `async` probably shouldn't be the inferred name for async
- // arrow functions...
+ // TODO(caitp): We should infer anonymous async functions as the empty
+ // string, not as the name of a function they're passed as a parameter to.
+ await test(async x => { throw new Error("FAIL") },
+ ["test", "test", "runTests"]);
await test(async() => { throw new Error("FAIL") },
- ["async", "test", "runTests"]);
-
- await test(async() => { await 1; throw new Error("FAIL") }, ["async"]);
+ ["test", "test", "runTests"]);
+ await test(async(a) => { throw new Error("FAIL") },
+ ["test", "test", "runTests"]);
+ await test(async(a, b) => { throw new Error("FAIL") },
+ ["test", "test", "runTests"]);
+
+ await test(async x => { await 1; throw new Error("FAIL") }, ["test"]);
+ await test(async() => { await 1; throw new Error("FAIL") }, ["test"]);
+ await test(async(a) => { await 1; throw new Error("FAIL") }, ["test"]);
+ await test(async(a, b) => { await 1; throw new Error("FAIL") }, ["test"]);
+
+ await test(async x => {
+ await 1;
+ try {
+ await thrower();
+ } catch (e) {
+ throw new Error("FAIL");
+ }
+ }, ["test"]);
await test(async() => {
await 1;
@@ -97,7 +115,34 @@ async function runTests() {
} catch (e) {
throw new Error("FAIL");
}
- }, ["async"]);
+ }, ["test"]);
+
+ await test(async(a) => {
+ await 1;
+ try {
+ await thrower();
+ } catch (e) {
+ throw new Error("FAIL");
+ }
+ }, ["test"]);
+
+ await test(async(a, b) => {
+ await 1;
+ try {
+ await thrower();
+ } catch (e) {
+ throw new Error("FAIL");
+ }
+ }, ["test"]);
+
+ await test(async x => {
+ await 1;
+ try {
+ await reject();
+ } catch (e) {
+ throw new Error("FAIL");
+ }
+ }, ["test"]);
await test(async() => {
await 1;
@@ -106,7 +151,25 @@ async function runTests() {
} catch (e) {
throw new Error("FAIL");
}
- }, ["async"]);
+ }, ["test"]);
+
+ await test(async(a) => {
+ await 1;
+ try {
+ await reject();
+ } catch (e) {
+ throw new Error("FAIL");
+ }
+ }, ["test"]);
+
+ await test(async(a, b) => {
+ await 1;
+ try {
+ await reject();
+ } catch (e) {
+ throw new Error("FAIL");
+ }
+ }, ["test"]);
}
runTests().catch(e => {
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698