| OLD | NEW |
| 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 --allow-natives-syntax | 5 // Flags: --allow-natives-syntax |
| 6 | 6 |
| 7 // Do not install `AsyncFunction` constructor on global object | 7 // Do not install `AsyncFunction` constructor on global object |
| 8 | 8 |
| 9 function assertThrowsAsync(run, errorType, message) { | 9 function assertThrowsAsync(run, errorType, message) { |
| 10 var actual; | 10 var actual; |
| 11 var hadValue = false; | 11 var hadValue = false; |
| 12 var hadError = false; | 12 var hadError = false; |
| 13 var promise = run(); | 13 var promise = run(); |
| 14 | 14 |
| 15 if (typeof promise !== "object" || typeof promise.then !== "function") { | 15 if (typeof promise !== "object" || typeof promise.then !== "function") { |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 "20", () => (async(foo, { a = "0" }) => foo + a)("2", { a: undefined })); | 383 "20", () => (async(foo, { a = "0" }) => foo + a)("2", { a: undefined })); |
| 384 assertThrows(() => eval("async({ foo = 1 })"), SyntaxError); | 384 assertThrows(() => eval("async({ foo = 1 })"), SyntaxError); |
| 385 assertThrows(() => eval("async(a, { foo = 1 })"), SyntaxError); | 385 assertThrows(() => eval("async(a, { foo = 1 })"), SyntaxError); |
| 386 | 386 |
| 387 // https://bugs.chromium.org/p/chromium/issues/detail?id=638019 | 387 // https://bugs.chromium.org/p/chromium/issues/detail?id=638019 |
| 388 async function gaga() { | 388 async function gaga() { |
| 389 let i = 1; | 389 let i = 1; |
| 390 while (i-- > 0) { await 42 } | 390 while (i-- > 0) { await 42 } |
| 391 } | 391 } |
| 392 assertDoesNotThrow(gaga); | 392 assertDoesNotThrow(gaga); |
| OLD | NEW |