Files
ladybird/Libraries/LibJS/Runtime/ClassConstruction.h
Andreas Kling fa6a3f31dc LibJS: Add AST-free construct_class()
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.
2026-02-11 23:57:41 +01:00

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);
}