mirror of
https://github.com/RGBCube/serenity
synced 2025-10-30 16:12:43 +00:00
- A regular function can have duplicate parameters except in strict mode
or if its parameter list is not "simple" (has a default or rest
parameter)
- An arrow function can never have duplicate parameters
Compared to other engines I opted for more useful syntax error messages
than a generic "duplicate parameter name not allowed in this context":
"use strict"; function test(foo, foo) {}
^
Uncaught exception: [SyntaxError]: Duplicate parameter 'foo' not allowed in strict mode (line: 1, column: 34)
function test(foo, foo = 1) {}
^
Uncaught exception: [SyntaxError]: Duplicate parameter 'foo' not allowed in function with default parameter (line: 1, column: 20)
function test(foo, ...foo) {}
^
Uncaught exception: [SyntaxError]: Duplicate parameter 'foo' not allowed in function with rest parameter (line: 1, column: 23)
(foo, foo) => {}
^
Uncaught exception: [SyntaxError]: Duplicate parameter 'foo' not allowed in arrow function (line: 1, column: 7)
|
||
|---|---|---|
| .. | ||
| array-basic.js | ||
| array-length-setter.js | ||
| array-shrink-during-find-crash.js | ||
| array-simple-and-generic-storage-initialization.js | ||
| array-spread.js | ||
| Array.from.js | ||
| Array.isArray.js | ||
| Array.js | ||
| Array.of.js | ||
| Array.prototype-generic-functions.js | ||
| Array.prototype.concat.js | ||
| Array.prototype.every.js | ||
| Array.prototype.fill.js | ||
| Array.prototype.filter.js | ||
| Array.prototype.find.js | ||
| Array.prototype.findIndex.js | ||
| Array.prototype.forEach.js | ||
| Array.prototype.includes.js | ||
| Array.prototype.indexOf.js | ||
| Array.prototype.join.js | ||
| Array.prototype.lastIndexOf.js | ||
| Array.prototype.map.js | ||
| Array.prototype.pop.js | ||
| Array.prototype.push.js | ||
| Array.prototype.reduce.js | ||
| Array.prototype.reduceRight.js | ||
| Array.prototype.reverse.js | ||
| Array.prototype.shift.js | ||
| Array.prototype.slice.js | ||
| Array.prototype.some.js | ||
| Array.prototype.splice.js | ||
| Array.prototype.toLocaleString.js | ||
| Array.prototype.toString.js | ||
| Array.prototype.unshift.js | ||
| Array.prototype.values.js | ||