Debian Codegraph @

js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js

raw
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 A function after top level await is an expression and not a hoistable declaration
8 info: |
9 ModuleItem:
10 StatementListItem[~Yield, +Await, ~Return]
11
12 ...
13
14 ExpressionStatement[Yield, Await]:
15 [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
16 Expression[+In, ?Yield, ?Await];
17
18 UnaryExpression[Yield, Await]
19 [+Await]AwaitExpression[?Yield]
20
21 AwaitExpression[Yield]:
22 await UnaryExpression[?Yield, +Await]
23
24 ...
25
26 PrimaryExpression[Yield, Await]:
27 this
28 IdentifierReference[?Yield, ?Await]
29 Literal
30 ArrayLiteral[?Yield, ?Await]
31 ObjectLiteral[?Yield, ?Await]
32 FunctionExpression
33 ClassExpression[?Yield, ?Await]
34 GeneratorExpression
35 AsyncFunctionExpression
36 AsyncGeneratorExpression
37 RegularExpressionLiteral
38 TemplateLiteral[?Yield, ?Await, ~Tagged]
39 CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
40 esid: prod-AwaitExpression
41 flags: [module, async]
42 features: [top-level-await]
43 ---*/
44
45 function fn() { return 42; }
46 await function fn() { return 111; };
47
48 assert.sameValue(fn(), 42);
49
50 $DONE();