Browse Source

Fix flatMap mapper function handling (#844)

Marko Lahma 4 years ago
parent
commit
55b9ef6bf6
2 changed files with 3 additions and 72 deletions
  1. 0 69
      Jint.Tests.Test262/test/skipped.json
  2. 3 3
      Jint/Native/Array/ArrayPrototype.cs

+ 0 - 69
Jint.Tests.Test262/test/skipped.json

@@ -219,75 +219,6 @@
     "reason": "requires toLocaleString changes"
   },
 
-  // experimentals start
-
-  {
-    "source": "built-ins/Array/prototype/flat/array-like-objects.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/bound-function-call.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/empty-array-elements.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/empty-object-elements.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/length.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/name.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/non-numeric-depth-should-not-throw.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/null-undefined-elements.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/positive-infinity.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flat/prop-desc.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flatMap/array-like-objects.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flatMap/bound-function-argument.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flatMap/depth-always-one.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flatMap/length.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flatMap/name.js",
-    "reason": "experimental"
-  },
-  {
-    "source": "built-ins/Array/prototype/flatMap/thisArg-argument.js",
-    "reason": "experimental"
-  },
-
-  // experimentals end
-
   {
     "source": "built-ins/String/prototype/padEnd/observable-operations.js",
     "reason": "observables not implemented"

+ 3 - 3
Jint/Native/Array/ArrayPrototype.cs

@@ -89,8 +89,8 @@ namespace Jint.Native.Array
                 ["findIndex"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "findIndex", FindIndex, 1, PropertyFlag.Configurable), propertyFlags),
                 ["keys"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "keys", Keys, 0, PropertyFlag.Configurable), propertyFlags),
                 ["values"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", Values, 0, PropertyFlag.Configurable), propertyFlags),
-                ["flat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", Flat, 0, PropertyFlag.Configurable), propertyFlags),
-                ["flatMap"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "values", FlatMap, 0, PropertyFlag.Configurable), propertyFlags),
+                ["flat"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "flat", Flat, 0, PropertyFlag.Configurable), propertyFlags),
+                ["flatMap"] = new PropertyDescriptor(new ClrFunctionInstance(Engine, "flatMap", FlatMap, 1, PropertyFlag.Configurable), propertyFlags),
             };
             SetProperties(properties);
 
@@ -522,7 +522,7 @@ namespace Jint.Native.Array
                     {
                         callArguments[0] = element;
                         callArguments[1] = JsNumber.Create(sourceIndex);
-                        mapperFunction.Call(thisArg, callArguments);
+                        element = mapperFunction.Call(thisArg, callArguments);
                     }
 
                     var shouldFlatten = false;