summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/defaults-invalid-syntax.js
blob: 6acf0955c11ac0136bb10db266a77db72d96aa7e (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; })) {}