Debian Codegraph @

js/src/tests/test262/language/statementList/eval-fn-array-literal.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/statementList/array-literal.case
3 // - src/statementList/default/eval-function-declaration.template
4 /*---
5 description: Array Literal (Eval production of StatementList starting with a Function Declaration)
6 esid: prod-StatementList
7 flags: [generated]
8 info: |
9 StatementList:
10 StatementListItem
11 StatementList StatementListItem
12
13 StatementListItem:
14 Statement
15 Declaration
16
17 Declaration:
18 HoistableDeclaration
19
20 FunctionDeclaration:
21 function BindingIdentifier ( FormalParameters ) { FunctionBody }
22
23 Statement:
24 BlockStatement
25 VariableStatement
26 EmptyStatement
27 ExpressionStatement
28 ...
29
30 ExpressionStatement:
31 [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
32 Expression ;
33
34 ArrayLiteral[Yield, Await]:
35 [ Elision_opt ]
36 [ ElementList ]
37 [ ElementList , Elision_opt ]
38 ---*/
39
40
41 var result = eval('function fn() {}[];');
42
43 assert.sameValue(Object.getPrototypeOf(result), Array.prototype);
44 assert.sameValue(result.length, 0);
45
46 reportCompare(0, 0);