2019-08-02 23:14:24 +02:00
|
|
|
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
description: >
|
|
|
|
Valid syntax for top level await.
|
2019-08-07 19:12:52 +02:00
|
|
|
AwaitExpression ImportCall
|
2019-08-02 23:14:24 +02:00
|
|
|
info: |
|
|
|
|
ModuleItem:
|
|
|
|
StatementListItem[~Yield, +Await, ~Return]
|
|
|
|
|
|
|
|
...
|
|
|
|
|
2019-08-07 19:12:52 +02:00
|
|
|
UnaryExpression[Yield, Await]
|
|
|
|
[+Await]AwaitExpression[?Yield]
|
|
|
|
|
|
|
|
AwaitExpression[Yield]:
|
|
|
|
await UnaryExpression[?Yield, +Await]
|
|
|
|
|
|
|
|
...
|
|
|
|
|
2019-08-02 23:14:24 +02:00
|
|
|
TryStatement[Yield, Await, Return]:
|
|
|
|
try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
|
|
|
|
try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
|
|
|
|
try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
|
|
|
|
|
2019-08-07 19:12:52 +02:00
|
|
|
Catch[Yield, Await, Return]:
|
|
|
|
catch(CatchParameter[?Yield, ?Await])Block[?Yield, ?Await, ?Return]
|
|
|
|
catchBlock[?Yield, ?Await, ?Return]
|
2019-08-02 23:14:24 +02:00
|
|
|
|
2019-08-07 19:12:52 +02:00
|
|
|
Finally[Yield, Await, Return]:
|
|
|
|
finallyBlock[?Yield, ?Await, ?Return]
|
2019-08-02 23:14:24 +02:00
|
|
|
|
2019-08-07 19:12:52 +02:00
|
|
|
CatchParameter[Yield, Await]:
|
|
|
|
BindingIdentifier[?Yield, ?Await]
|
|
|
|
BindingPattern[?Yield, ?Await]
|
2019-08-02 23:14:24 +02:00
|
|
|
esid: prod-AwaitExpression
|
|
|
|
flags: [module]
|
2019-08-07 19:12:52 +02:00
|
|
|
features: [top-level-await, dynamic-import]
|
2019-08-02 23:14:24 +02:00
|
|
|
---*/
|
|
|
|
|
2019-08-07 19:32:17 +02:00
|
|
|
try {} catch ({ x = await 42 }) {} // Initializer
|
|
|
|
try {} catch ({ x: y = await 42 }) {} // BindingElement Initializer
|
|
|
|
try {} catch ([ x = await 42 ]) {}
|