summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Function/rest-has-duplicated.js
blob: 67577ab4e3437e09b53eac950499d1f7f4a1b3ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Make sure duplicated name is allowed in non-strict.
function f0(a, a) {
}

// SyntaxError should be thrown if rest parameter name is duplicated.
assertThrowsInstanceOf(() => eval(`
function f1(a, ...a) {
}
`), SyntaxError);

// SyntaxError should be thrown if there is a duplicated parameter.
assertThrowsInstanceOf(() => eval(`
function f2(a, a, ...b) {
}
`), SyntaxError);

reportCompare(0, 0, 'ok');