mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Add a standalone construct_class() function that builds a class from a ClassBlueprint and an Executable, replacing the virtual dispatch through ClassElement::class_element_evaluation() with a direct switch on ClassElementDescriptor::Kind. This function reads pre-compiled SharedFunctionInstanceData indices from the blueprint, creates ECMAScriptFunctionObjects at runtime, and handles all class element types: methods, getters, setters, fields (with initializers), and static initializers. The function exists but is not yet called. No behavioral change.
27 lines
617 B
C++
27 lines
617 B
C++
/*
|
|
* Copyright (c) 2026, Andreas Kling <andreas@ladybird.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibJS/Bytecode/ClassBlueprint.h>
|
|
#include <LibJS/Forward.h>
|
|
#include <LibJS/Runtime/Completion.h>
|
|
|
|
namespace JS {
|
|
|
|
ThrowCompletionOr<ECMAScriptFunctionObject*> construct_class(
|
|
VM&,
|
|
Bytecode::ClassBlueprint const&,
|
|
Bytecode::Executable const&,
|
|
Environment* class_environment,
|
|
Environment* outer_environment,
|
|
Value super_class,
|
|
ReadonlySpan<Value> element_keys,
|
|
Optional<Utf16FlyString> const& binding_name,
|
|
Utf16FlyString const& class_name);
|
|
|
|
}
|