if-await-expr.js (646B)
1 // |reftest| module async 2 // Copyright (C) 2019 Leo Balter. All rights reserved. 3 // This code is governed by the BSD license found in the LICENSE file. 4 5 /*--- 6 description: > 7 Evaluate Await expression for IfStatement 8 info: | 9 ModuleItem: 10 StatementListItem[~Yield, +Await, ~Return] 11 12 ... 13 14 UnaryExpression[Yield, Await] 15 [+Await]AwaitExpression[?Yield] 16 17 AwaitExpression[Yield]: 18 await UnaryExpression[?Yield, +Await] 19 esid: prod-AwaitExpression 20 flags: [module, async] 21 features: [top-level-await] 22 ---*/ 23 24 var completed = 0; 25 var p = Promise.resolve(true); 26 27 if (await p) { 28 completed += 1; 29 } 30 31 assert.sameValue(completed, 1); 32 33 $DONE();