summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-02-07 18:51:58 +0100
committerAndreas Kling <kling@serenityos.org>2022-02-07 19:16:46 +0100
commitaeb72fe9d0a188c9e72b58ebad9618ff924af1f1 (patch)
tree93f34e6d060cf9ed75c4a2e2bda772896493cd46 /Userland
parent6ddbe8f953c77231a609ab9d12ee0e46d60fb0c8 (diff)
downloadserenity-aeb72fe9d0a188c9e72b58ebad9618ff924af1f1.zip
LibJS: Reduce header dependency graph in Realm.h
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Module.h1
-rw-r--r--Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp1
-rw-r--r--Userland/Libraries/LibJS/Runtime/ModuleEnvironment.cpp2
-rw-r--r--Userland/Libraries/LibJS/Runtime/Realm.cpp9
-rw-r--r--Userland/Libraries/LibJS/Runtime/Realm.h10
-rw-r--r--Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp1
-rw-r--r--Userland/Libraries/LibJS/Script.cpp1
-rw-r--r--Userland/Libraries/LibJS/SyntheticModule.cpp2
-rw-r--r--Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp1
9 files changed, 20 insertions, 8 deletions
diff --git a/Userland/Libraries/LibJS/Module.h b/Userland/Libraries/LibJS/Module.h
index 051f0cb7f7..6286442283 100644
--- a/Userland/Libraries/LibJS/Module.h
+++ b/Userland/Libraries/LibJS/Module.h
@@ -7,6 +7,7 @@
#pragma once
+#include <AK/FlyString.h>
#include <LibJS/Heap/Handle.h>
#include <LibJS/Runtime/Realm.h>
diff --git a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
index ebeb2e80a0..2a75c27fca 100644
--- a/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
+++ b/Userland/Libraries/LibJS/Runtime/FunctionConstructor.cpp
@@ -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>
diff --git a/Userland/Libraries/LibJS/Runtime/ModuleEnvironment.cpp b/Userland/Libraries/LibJS/Runtime/ModuleEnvironment.cpp
index e02cca0d2f..bcfd09cda4 100644
--- a/Userland/Libraries/LibJS/Runtime/ModuleEnvironment.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ModuleEnvironment.cpp
@@ -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 {
diff --git a/Userland/Libraries/LibJS/Runtime/Realm.cpp b/Userland/Libraries/LibJS/Runtime/Realm.cpp
index d269bb5f71..4f73ab44a3 100644
--- a/Userland/Libraries/LibJS/Runtime/Realm.cpp
+++ b/Userland/Libraries/LibJS/Runtime/Realm.cpp
@@ -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)
{
diff --git a/Userland/Libraries/LibJS/Runtime/Realm.h b/Userland/Libraries/LibJS/Runtime/Realm.h
index 1972eee32b..551b9675b7 100644
--- a/Userland/Libraries/LibJS/Runtime/Realm.h
+++ b/Userland/Libraries/LibJS/Runtime/Realm.h
@@ -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);
diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
index cf0b09b6b6..25da802af7 100644
--- a/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
+++ b/Userland/Libraries/LibJS/Runtime/ShadowRealm.cpp
@@ -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>
diff --git a/Userland/Libraries/LibJS/Script.cpp b/Userland/Libraries/LibJS/Script.cpp
index bc9b89b3bb..889c0e7ff5 100644
--- a/Userland/Libraries/LibJS/Script.cpp
+++ b/Userland/Libraries/LibJS/Script.cpp
@@ -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 {
diff --git a/Userland/Libraries/LibJS/SyntheticModule.cpp b/Userland/Libraries/LibJS/SyntheticModule.cpp
index 0d3e6249bb..b16c821103 100644
--- a/Userland/Libraries/LibJS/SyntheticModule.cpp
+++ b/Userland/Libraries/LibJS/SyntheticModule.cpp
@@ -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>
diff --git a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
index 6f39fa59fd..4d19fbf803 100644
--- a/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
+++ b/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp
@@ -5,6 +5,7 @@
*/
#include <LibJS/Module.h>
+#include <LibJS/Runtime/Environment.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Bindings/MainThreadVM.h>