Debian Codegraph @

js/src/jit-test/tests/basic/spread-call-setcall.js

raw
1 load(libdir + "asserts.js");
2
3 function g() {
4 }
5
6 let a = {
7 g: function() {
8 }
9 };
10
11 function check(expr) {
12 assertThrowsInstanceOf(Function(expr), ReferenceError);
13 }
14 function checkDestructuring(expr) {
15 assertThrowsInstanceOf(() => Function(expr), SyntaxError);
16 }
17
18 check("g(...[]) = 1");
19 check("a.g(...[]) = 1");
20 check("eval(...['1']) = 1");
21 check("g(...[]) ++");
22 check("a.g(...[]) ++");
23 check("eval(...['1']) ++");
24 checkDestructuring("[g(...[])] = []");
25 checkDestructuring("[a.g(...[])] = []");
26 checkDestructuring("[eval(...['1'])] = []");
27 checkDestructuring("({y: g(...[])} = 1)");
28 checkDestructuring("({y: a.g(...[])} = 1)");
29 checkDestructuring("({y: eval(...['1'])} = 1)");