LibJS: Implement basic functionality of Array.from()

The optional 2nd and 3rd arguments are not yet implemented.

This assumes that `this` is the Array constructor and doesn't yet
implement the more general behavior in the ES6 spec that allows
transferring this method to other constructors.
This commit is contained in:
Nico Weber 2020-08-17 09:52:24 -04:00 committed by Andreas Kling
commit 8ebef785eb
Notes: sideshowbarker 2024-07-19 03:28:59 +09:00
3 changed files with 109 additions and 0 deletions

View file

@ -44,6 +44,7 @@ public:
private:
virtual bool has_constructor() const override { return true; }
JS_DECLARE_NATIVE_FUNCTION(from);
JS_DECLARE_NATIVE_FUNCTION(is_array);
JS_DECLARE_NATIVE_FUNCTION(of);
};