summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebIDL/OverloadResolution.h
blob: dbed20a9ab59031c640c9443892866f2cd636226 (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
/*
 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Optional.h>
#include <AK/Vector.h>
#include <LibIDL/Types.h>
#include <LibJS/Runtime/VM.h>

namespace Web::WebIDL {

struct ResolvedOverload {
    // Corresponds to "the special value “missing”" in the overload resolution algorithm.
    struct Missing { };
    using Argument = Variant<JS::Value, Missing>;

    int callable_id;
    Vector<Argument> arguments;
};

// https://webidl.spec.whatwg.org/#es-overloads
JS::ThrowCompletionOr<ResolvedOverload> resolve_overload(JS::VM&, IDL::EffectiveOverloadSet&);

}