await-expr-dyn-import.js (992B)
1 // |reftest| module 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 Valid syntax for top level await. 8 AwaitExpression ImportCall 9 info: | 10 ModuleItem: 11 StatementListItem[~Yield, +Await, ~Return] 12 13 ... 14 15 UnaryExpression[Yield, Await] 16 [+Await]AwaitExpression[?Yield] 17 18 AwaitExpression[Yield]: 19 await UnaryExpression[?Yield, +Await] 20 21 ... 22 23 LeftHandSideExpression[Yield, Await]: 24 NewExpression[?Yield, ?Await] 25 CallExpression[?Yield, ?Await] 26 27 CallExpression[Yield, Await]: 28 ImportCall[?Yield, ?Await] 29 30 ImportCall[Yield, Await]: 31 import ( AssignmentExpression[+In, ?Yield, ?Await] ) 32 esid: prod-AwaitExpression 33 flags: [module] 34 features: [top-level-await, dynamic-import] 35 ---*/ 36 37 try { 38 await import('foo'); 39 } catch (e) { 40 // Ignore errors, we are just checking if the syntax is valid and 41 // we should not worry if a module was loaded. 42 } 43 44 reportCompare(0, 0);