/src/serenity/Userland/Libraries/LibJS/Runtime/PromiseConstructor.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibJS/Runtime/NativeFunction.h> |
10 | | |
11 | | namespace JS { |
12 | | |
13 | | class PromiseConstructor final : public NativeFunction { |
14 | | JS_OBJECT(PromiseConstructor, NativeFunction); |
15 | | JS_DECLARE_ALLOCATOR(PromiseConstructor); |
16 | | |
17 | | public: |
18 | | virtual void initialize(Realm&) override; |
19 | | virtual ~PromiseConstructor() override = default; |
20 | | |
21 | | virtual ThrowCompletionOr<Value> call() override; |
22 | | virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override; |
23 | | |
24 | | private: |
25 | | explicit PromiseConstructor(Realm&); |
26 | | |
27 | 0 | virtual bool has_constructor() const override { return true; } |
28 | | |
29 | | JS_DECLARE_NATIVE_FUNCTION(all); |
30 | | JS_DECLARE_NATIVE_FUNCTION(all_settled); |
31 | | JS_DECLARE_NATIVE_FUNCTION(any); |
32 | | JS_DECLARE_NATIVE_FUNCTION(race); |
33 | | JS_DECLARE_NATIVE_FUNCTION(reject); |
34 | | JS_DECLARE_NATIVE_FUNCTION(resolve); |
35 | | JS_DECLARE_NATIVE_FUNCTION(symbol_species_getter); |
36 | | JS_DECLARE_NATIVE_FUNCTION(try_); |
37 | | JS_DECLARE_NATIVE_FUNCTION(with_resolvers); |
38 | | }; |
39 | | |
40 | | } |