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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --harmony-async-await 5 // Flags: --harmony-async-await
6 6
7 async function test(func, funcs) { 7 async function test(func, funcs) {
8 try { 8 try {
9 await func(); 9 await func();
10 throw new Error("Expected " + func.toString() + " to throw"); 10 throw new Error("Expected " + func.toString() + " to throw");
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 await test((new class { async c3() { 76 await test((new class { async c3() {
77 await 1; 77 await 1;
78 try { await thrower(); } catch (e) { throw new Error("FAIL"); } 78 try { await thrower(); } catch (e) { throw new Error("FAIL"); }
79 } }).c3, ["c3"]); 79 } }).c3, ["c3"]);
80 80
81 await test((new class { async c4() { 81 await test((new class { async c4() {
82 await 1; 82 await 1;
83 try { await reject(); } catch (e) { throw new Error("FAIL"); } 83 try { await reject(); } catch (e) { throw new Error("FAIL"); }
84 } }).c4, ["c4"]); 84 } }).c4, ["c4"]);
85 85
86 // TODO(caitp): `async` probably shouldn't be the inferred name for async 86 // TODO(caitp): We should infer anonymous async functions as the empty
87 // arrow functions... 87 // string, not as the name of a function they're passed as a parameter to.
88 await test(async x => { throw new Error("FAIL") },
89 ["test", "test", "runTests"]);
88 await test(async() => { throw new Error("FAIL") }, 90 await test(async() => { throw new Error("FAIL") },
89 ["async", "test", "runTests"]); 91 ["test", "test", "runTests"]);
92 await test(async(a) => { throw new Error("FAIL") },
93 ["test", "test", "runTests"]);
94 await test(async(a, b) => { throw new Error("FAIL") },
95 ["test", "test", "runTests"]);
90 96
91 await test(async() => { await 1; throw new Error("FAIL") }, ["async"]); 97 await test(async x => { await 1; throw new Error("FAIL") }, ["test"]);
98 await test(async() => { await 1; throw new Error("FAIL") }, ["test"]);
99 await test(async(a) => { await 1; throw new Error("FAIL") }, ["test"]);
100 await test(async(a, b) => { await 1; throw new Error("FAIL") }, ["test"]);
101
102 await test(async x => {
103 await 1;
104 try {
105 await thrower();
106 } catch (e) {
107 throw new Error("FAIL");
108 }
109 }, ["test"]);
92 110
93 await test(async() => { 111 await test(async() => {
94 await 1; 112 await 1;
95 try { 113 try {
96 await thrower(); 114 await thrower();
97 } catch (e) { 115 } catch (e) {
98 throw new Error("FAIL"); 116 throw new Error("FAIL");
99 } 117 }
100 }, ["async"]); 118 }, ["test"]);
119
120 await test(async(a) => {
121 await 1;
122 try {
123 await thrower();
124 } catch (e) {
125 throw new Error("FAIL");
126 }
127 }, ["test"]);
128
129 await test(async(a, b) => {
130 await 1;
131 try {
132 await thrower();
133 } catch (e) {
134 throw new Error("FAIL");
135 }
136 }, ["test"]);
137
138 await test(async x => {
139 await 1;
140 try {
141 await reject();
142 } catch (e) {
143 throw new Error("FAIL");
144 }
145 }, ["test"]);
101 146
102 await test(async() => { 147 await test(async() => {
103 await 1; 148 await 1;
104 try { 149 try {
105 await reject(); 150 await reject();
106 } catch (e) { 151 } catch (e) {
107 throw new Error("FAIL"); 152 throw new Error("FAIL");
108 } 153 }
109 }, ["async"]); 154 }, ["test"]);
155
156 await test(async(a) => {
157 await 1;
158 try {
159 await reject();
160 } catch (e) {
161 throw new Error("FAIL");
162 }
163 }, ["test"]);
164
165 await test(async(a, b) => {
166 await 1;
167 try {
168 await reject();
169 } catch (e) {
170 throw new Error("FAIL");
171 }
172 }, ["test"]);
110 } 173 }
111 174
112 runTests().catch(e => { 175 runTests().catch(e => {
113 print(e); 176 print(e);
114 quit(1); 177 quit(1);
115 }); 178 });
OLDNEW
« 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