summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/defaults-invalid-syntax.js
blob: f1e1e508afea9e4987b87f86f2fdb900538bb67e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
load(libdir + "asserts.js");

assertThrowsInstanceOf(function () {
    eval("function f(...rest=23) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a=yield 24) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a={a : 19 + (yield 24).prop}) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a=1,a=1) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a,a=1) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a=1,a) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a,a,b=1) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a,b=1,a=1) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
    eval("function f(a=1,b=1,a=1) {}");
}, SyntaxError);
function silly_but_okay(a=(function* () { yield 97; })) {}