1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 22:08:12 +00:00
serenity/Libraries/LibJS/Tests/builtins
Linus Groh dca9e4ec10 LibJS: Implement rules for duplicate function parameters
- 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)
2020-10-25 12:56:02 +01:00
..
Array LibJS: Implement rules for duplicate function parameters 2020-10-25 12:56:02 +01:00
BigInt Everywhere: Fix typos 2020-10-02 16:03:17 +02:00
Boolean LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Date LibJS: Add some more tests, mostly around leap years 2020-08-26 08:52:07 +02:00
Error LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Function LibJS: Add Symbol.hasInstance tests 2020-07-14 20:15:19 +02:00
functions LibJS: Split isNaN tests into multiple sections 2020-07-06 23:40:35 +02:00
Infinity LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
JSON LibJS: Handle getter exception in JSONObject::serialize_json_property() 2020-09-19 14:17:22 +02:00
Math JS Tests: Disable the one failing test when running test-js in Serenity 2020-08-25 21:23:10 +02:00
NaN LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Number LibJS: Add Number.prototype.toString 2020-07-15 18:24:55 +02:00
Object LibJS: Don't change offset when reconfiguring property in unique shape 2020-10-10 23:25:00 +02:00
Proxy LibJS: Indent tests with 4 spaces instead of 2 2020-07-06 23:40:35 +02:00
Reflect LibJS: Object.preventExtensions should allow property modfication 2020-07-07 10:47:10 +02:00
String LibJS: Implement String.prototype.charCodeAt 2020-07-22 15:48:01 +02:00
Symbol LibJS: Allow conversion from Symbol to String via explicit String() call 2020-08-22 10:52:40 +02:00