LibJS: Reduce header dependency graph in Realm.h

This commit is contained in:
Andreas Kling 2022-02-07 18:51:58 +01:00
parent 6ddbe8f953
commit aeb72fe9d0
Notes: sideshowbarker 2024-07-17 19:38:56 +09:00
9 changed files with 20 additions and 8 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/FlyString.h>
#include <LibJS/Heap/Handle.h>
#include <LibJS/Runtime/Realm.h>

View file

@ -13,6 +13,7 @@
#include <LibJS/Runtime/FunctionConstructor.h>
#include <LibJS/Runtime/FunctionObject.h>
#include <LibJS/Runtime/GeneratorPrototype.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Realm.h>

View file

@ -5,7 +5,9 @@
*/
#include <LibJS/AST.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/ModuleEnvironment.h>
#include <LibJS/Runtime/VM.h>
namespace JS {

View file

@ -4,10 +4,19 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Realm.h>
#include <LibJS/Runtime/VM.h>
namespace JS {
// 9.3.1 CreateRealm ( ), https://tc39.es/ecma262/#sec-createrealm
Realm* Realm::create(VM& vm)
{
return vm.heap().allocate_without_global_object<Realm>();
}
// 9.3.3 SetRealmGlobalObject ( realmRec, globalObj, thisValue ), https://tc39.es/ecma262/#sec-setrealmglobalobject
void Realm::set_global_object(GlobalObject& global_object, Object* this_value)
{

View file

@ -1,15 +1,15 @@
/*
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/OwnPtr.h>
#include <AK/Weakable.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/GlobalObject.h>
namespace JS {
@ -24,11 +24,7 @@ public:
Realm() = default;
// 9.3.1 CreateRealm ( ), https://tc39.es/ecma262/#sec-createrealm
static Realm* create(VM& vm)
{
return vm.heap().allocate_without_global_object<Realm>();
}
static Realm* create(VM&);
void set_global_object(GlobalObject&, Object* this_value = nullptr);

View file

@ -8,6 +8,7 @@
#include <LibJS/Parser.h>
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/DeclarativeEnvironment.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/ModuleNamespaceObject.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/PromiseConstructor.h>

View file

@ -7,6 +7,7 @@
#include <LibJS/AST.h>
#include <LibJS/Lexer.h>
#include <LibJS/Parser.h>
#include <LibJS/Runtime/VM.h>
#include <LibJS/Script.h>
namespace JS {

View file

@ -6,7 +6,7 @@
#include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/JSONObject.h>
#include <LibJS/Runtime/GlobalEnvironment.h>
#include <LibJS/Runtime/ModuleEnvironment.h>
#include <LibJS/Runtime/VM.h>
#include <LibJS/SyntheticModule.h>

View file

@ -5,6 +5,7 @@
*/
#include <LibJS/Module.h>
#include <LibJS/Runtime/Environment.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Bindings/MainThreadVM.h>