summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/Function/parameter-redeclaration.js
blob: 74e55e3aa9e406e38d0f6a92cde41b655513170c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 'var' is allowed to redeclare parameters.
function f1(a = 0) {
  var a;
}

// 'let' and 'const' at body-level are not allowed to redeclare parameters.
assertThrowsInstanceOf(() => {
  eval(`function f2(a = 0) {
    let a;
  }`);
}, SyntaxError);
assertThrowsInstanceOf(() => {
  eval(`function f3(a = 0) {
    const a;
  }`);
}, SyntaxError);

if (typeof reportCompare === "function")
  reportCompare(true, true);