1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 19:45:07 +00:00

LibIDL+LibWeb: Resolve distinguishing argument index at build time

Aside from the obvious performance benefits, this will allow us to
properly handle dictionary types. (whose dictionary-ness is only known
at build-time)

Much of the rest of the overload resolution algorithm steps can (and
should) be evaluated at build-time as well, but this is a good first
step.
This commit is contained in:
Idan Horowitz 2023-11-10 23:38:59 +02:00 committed by Andreas Kling
parent 048e179572
commit f837f02eea
4 changed files with 44 additions and 43 deletions

View file

@ -56,6 +56,8 @@ static bool has_overload_with_argument_type_or_subtype_matching(IDL::EffectiveOv
// https://webidl.spec.whatwg.org/#es-overloads
JS::ThrowCompletionOr<ResolvedOverload> resolve_overload(JS::VM& vm, IDL::EffectiveOverloadSet& overloads)
{
// FIXME: The vast majority of this algorithm can be (and must be, in order to resolve the dictionary
// related FIXMEs below) evaluated at code-generation time.
// 1. Let maxarg be the length of the longest type list of the entries in S.
// 2. Let n be the size of args.
// 3. Initialize argcount to be min(maxarg, n).