summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Runtime/Array.h
blob: 58b4b19c8b61e79b06ad80e3210c35fa61e83b6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibJS/Runtime/Object.h>

namespace JS {

class Array : public Object {
    JS_OBJECT(Array, Object);

public:
    static Array* create(GlobalObject&);
    static Array* create_from(GlobalObject&, const Vector<Value>&);

    explicit Array(Object& prototype);
    virtual void initialize(GlobalObject&) override;
    virtual ~Array() override;

    static Array* typed_this(VM&, GlobalObject&);

private:
    virtual bool is_array() const override { return true; }

    JS_DECLARE_NATIVE_GETTER(length_getter);
    JS_DECLARE_NATIVE_SETTER(length_setter);
};

}