Browse Source

LibJS/Tests: Rename function parameter from 'arguments' to 'arguments_'

The former has a special meaning and should be avoided where possible.
Linus Groh 4 năm trước cách đây
mục cha
commit
d1a72dc6eb

+ 5 - 3
Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-apply.js

@@ -11,11 +11,13 @@ describe("[[Call]] trap normal behavior", () => {
     test("correct arguments supplied to trap", () => {
         const f = (a, b) => a + b;
         const handler = {
-            apply(target, this_, arguments) {
+            apply(target, this_, arguments_) {
                 expect(target).toBe(f);
                 expect(this_).toBe(handler);
-                if (arguments[2]) return arguments[0] * arguments[1];
-                return f(...arguments);
+                if (arguments_[2]) {
+                    return arguments_[0] * arguments_[1];
+                }
+                return f(...arguments_);
             },
         };
         p = new Proxy(f, handler);

+ 10 - 6
Userland/Libraries/LibJS/Tests/builtins/Proxy/Proxy.handler-construct.js

@@ -27,11 +27,13 @@ describe("[[Construct]] trap normal behavior", () => {
 
         let p;
         const handler = {
-            construct(target, arguments, newTarget) {
+            construct(target, arguments_, newTarget) {
                 expect(target).toBe(f);
                 expect(newTarget).toBe(p);
-                if (arguments[1]) return Reflect.construct(target, [arguments[0] * 2], newTarget);
-                return Reflect.construct(target, arguments, newTarget);
+                if (arguments_[1]) {
+                    return Reflect.construct(target, [arguments_[0] * 2], newTarget);
+                }
+                return Reflect.construct(target, arguments_, newTarget);
             },
         };
         p = new Proxy(f, handler);
@@ -48,11 +50,13 @@ describe("[[Construct]] trap normal behavior", () => {
         let p;
         function theNewTarget() {}
         const handler = {
-            construct(target, arguments, newTarget) {
+            construct(target, arguments_, newTarget) {
                 expect(target).toBe(f);
                 expect(newTarget).toBe(theNewTarget);
-                if (arguments[1]) return Reflect.construct(target, [arguments[0] * 2], newTarget);
-                return Reflect.construct(target, arguments, newTarget);
+                if (arguments_[1]) {
+                    return Reflect.construct(target, [arguments_[0] * 2], newTarget);
+                }
+                return Reflect.construct(target, arguments_, newTarget);
             },
         };
         p = new Proxy(f, handler);