Ver código fonte

LibJS: Hide all the constructors!

Now that the GC allocator is able to invoke Cell subclass constructors
directly via friendship, we no longer need to keep them public. :^)
Andreas Kling 2 anos atrás
pai
commit
35c9aa7c05
100 arquivos alterados com 231 adições e 118 exclusões
  1. 2 1
      Userland/Libraries/LibJS/Contrib/Test262/$262Object.h
  2. 2 1
      Userland/Libraries/LibJS/Contrib/Test262/AgentObject.h
  3. 5 4
      Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h
  4. 2 1
      Userland/Libraries/LibJS/Contrib/Test262/IsHTMLDDA.h
  5. 6 6
      Userland/Libraries/LibJS/Runtime/Accessor.h
  6. 2 1
      Userland/Libraries/LibJS/Runtime/AggregateError.h
  7. 1 1
      Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.h
  8. 3 1
      Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.h
  9. 2 2
      Userland/Libraries/LibJS/Runtime/ArgumentsObject.h
  10. 3 0
      Userland/Libraries/LibJS/Runtime/Array.h
  11. 3 2
      Userland/Libraries/LibJS/Runtime/ArrayBuffer.h
  12. 2 1
      Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.h
  13. 2 1
      Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.h
  14. 2 1
      Userland/Libraries/LibJS/Runtime/ArrayConstructor.h
  15. 2 1
      Userland/Libraries/LibJS/Runtime/ArrayIterator.h
  16. 2 1
      Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h
  17. 2 1
      Userland/Libraries/LibJS/Runtime/ArrayPrototype.h
  18. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h
  19. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.h
  20. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.h
  21. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncFunctionDriverWrapper.h
  22. 3 1
      Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.h
  23. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncGenerator.h
  24. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.h
  25. 3 1
      Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.h
  26. 3 1
      Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.h
  27. 2 1
      Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h
  28. 2 1
      Userland/Libraries/LibJS/Runtime/AtomicsObject.h
  29. 2 1
      Userland/Libraries/LibJS/Runtime/BigInt.h
  30. 2 1
      Userland/Libraries/LibJS/Runtime/BigIntConstructor.h
  31. 2 1
      Userland/Libraries/LibJS/Runtime/BigIntObject.h
  32. 2 1
      Userland/Libraries/LibJS/Runtime/BigIntPrototype.h
  33. 2 1
      Userland/Libraries/LibJS/Runtime/BooleanConstructor.h
  34. 3 1
      Userland/Libraries/LibJS/Runtime/BooleanObject.h
  35. 2 1
      Userland/Libraries/LibJS/Runtime/BooleanPrototype.h
  36. 2 1
      Userland/Libraries/LibJS/Runtime/BoundFunction.h
  37. 2 1
      Userland/Libraries/LibJS/Runtime/ConsoleObject.h
  38. 2 1
      Userland/Libraries/LibJS/Runtime/DataView.h
  39. 2 1
      Userland/Libraries/LibJS/Runtime/DataViewConstructor.h
  40. 2 1
      Userland/Libraries/LibJS/Runtime/DataViewPrototype.h
  41. 2 1
      Userland/Libraries/LibJS/Runtime/Date.h
  42. 2 1
      Userland/Libraries/LibJS/Runtime/DateConstructor.h
  43. 2 1
      Userland/Libraries/LibJS/Runtime/DatePrototype.h
  44. 4 3
      Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.h
  45. 2 1
      Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h
  46. 3 1
      Userland/Libraries/LibJS/Runtime/Error.h
  47. 8 3
      Userland/Libraries/LibJS/Runtime/ErrorConstructor.h
  48. 5 2
      Userland/Libraries/LibJS/Runtime/ErrorPrototype.h
  49. 2 1
      Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h
  50. 2 1
      Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.h
  51. 2 1
      Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.h
  52. 2 1
      Userland/Libraries/LibJS/Runtime/FunctionConstructor.h
  53. 2 1
      Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h
  54. 2 1
      Userland/Libraries/LibJS/Runtime/FunctionPrototype.h
  55. 2 1
      Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.h
  56. 3 1
      Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.h
  57. 2 1
      Userland/Libraries/LibJS/Runtime/GeneratorObject.h
  58. 2 1
      Userland/Libraries/LibJS/Runtime/GeneratorPrototype.h
  59. 2 2
      Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h
  60. 3 1
      Userland/Libraries/LibJS/Runtime/GlobalObject.h
  61. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/Collator.h
  62. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h
  63. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.h
  64. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.h
  65. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormat.h
  66. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.h
  67. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h
  68. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.h
  69. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNames.h
  70. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.h
  71. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.h
  72. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.h
  73. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.h
  74. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.h
  75. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/Intl.h
  76. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/ListFormat.h
  77. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.h
  78. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.h
  79. 3 2
      Userland/Libraries/LibJS/Runtime/Intl/Locale.h
  80. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.h
  81. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.h
  82. 5 2
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.h
  83. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.h
  84. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h
  85. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.h
  86. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h
  87. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.h
  88. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.h
  89. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormat.h
  90. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.h
  91. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.h
  92. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.h
  93. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.h
  94. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/Segmenter.h
  95. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.h
  96. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.h
  97. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/Segments.h
  98. 2 1
      Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.h
  99. 2 2
      Userland/Libraries/LibJS/Runtime/Intrinsics.h
  100. 2 1
      Userland/Libraries/LibJS/Runtime/IteratorPrototype.h

+ 2 - 1
Userland/Libraries/LibJS/Contrib/Test262/$262Object.h

@@ -17,11 +17,12 @@ class $262Object final : public Object {
     JS_OBJECT($262Object, Object);
 
 public:
-    explicit $262Object(Realm&);
     virtual void initialize(JS::Realm&) override;
     virtual ~$262Object() override = default;
 
 private:
+    explicit $262Object(Realm&);
+
     virtual void visit_edges(Visitor&) override;
 
     AgentObject* m_agent { nullptr };

+ 2 - 1
Userland/Libraries/LibJS/Contrib/Test262/AgentObject.h

@@ -15,11 +15,12 @@ class AgentObject final : public Object {
     JS_OBJECT(AgentObject, Object);
 
 public:
-    explicit AgentObject(Realm&);
     virtual void initialize(JS::Realm&) override;
     virtual ~AgentObject() override = default;
 
 private:
+    explicit AgentObject(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(monotonic_now);
     JS_DECLARE_NATIVE_FUNCTION(sleep);
 };

+ 5 - 4
Userland/Libraries/LibJS/Contrib/Test262/GlobalObject.h

@@ -15,16 +15,17 @@ class GlobalObject final : public JS::GlobalObject {
     JS_OBJECT(GlobalObject, JS::GlobalObject);
 
 public:
-    GlobalObject(JS::Realm& realm)
-        : JS::GlobalObject(realm)
-    {
-    }
     virtual void initialize(Realm&) override;
     virtual ~GlobalObject() override = default;
 
     $262Object* $262() const { return m_$262; }
 
 private:
+    GlobalObject(JS::Realm& realm)
+        : JS::GlobalObject(realm)
+    {
+    }
+
     virtual void visit_edges(Visitor&) override;
 
     $262Object* m_$262 { nullptr };

+ 2 - 1
Userland/Libraries/LibJS/Contrib/Test262/IsHTMLDDA.h

@@ -14,12 +14,13 @@ class IsHTMLDDA final : public NativeFunction {
     JS_OBJECT(IsHTMLDDA, NativeFunction);
 
 public:
-    explicit IsHTMLDDA(Realm&);
     virtual ~IsHTMLDDA() override = default;
 
     virtual ThrowCompletionOr<Value> call() override;
 
 private:
+    explicit IsHTMLDDA(Realm&);
+
     virtual bool is_htmldda() const override { return true; }
 };
 

+ 6 - 6
Userland/Libraries/LibJS/Runtime/Accessor.h

@@ -22,12 +22,6 @@ public:
         return vm.heap().allocate_without_realm<Accessor>(getter, setter);
     }
 
-    Accessor(FunctionObject* getter, FunctionObject* setter)
-        : m_getter(getter)
-        , m_setter(setter)
-    {
-    }
-
     FunctionObject* getter() const { return m_getter; }
     void set_getter(FunctionObject* getter) { m_getter = getter; }
 
@@ -41,6 +35,12 @@ public:
     }
 
 private:
+    Accessor(FunctionObject* getter, FunctionObject* setter)
+        : m_getter(getter)
+        , m_setter(setter)
+    {
+    }
+
     FunctionObject* m_getter { nullptr };
     FunctionObject* m_setter { nullptr };
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AggregateError.h

@@ -16,9 +16,10 @@ class AggregateError : public Error {
 
 public:
     static AggregateError* create(Realm&);
+    virtual ~AggregateError() override = default;
 
+private:
     explicit AggregateError(Object& prototype);
-    virtual ~AggregateError() override = default;
 };
 
 }

+ 1 - 1
Userland/Libraries/LibJS/Runtime/AggregateErrorConstructor.h

@@ -14,7 +14,6 @@ class AggregateErrorConstructor final : public NativeFunction {
     JS_OBJECT(AggregateErrorConstructor, NativeFunction);
 
 public:
-    explicit AggregateErrorConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AggregateErrorConstructor() override = default;
 
@@ -22,6 +21,7 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit AggregateErrorConstructor(Realm&);
     virtual bool has_constructor() const override { return true; }
 };
 

+ 3 - 1
Userland/Libraries/LibJS/Runtime/AggregateErrorPrototype.h

@@ -14,9 +14,11 @@ class AggregateErrorPrototype final : public Object {
     JS_OBJECT(AggregateErrorPrototype, Object);
 
 public:
-    explicit AggregateErrorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AggregateErrorPrototype() override = default;
+
+private:
+    explicit AggregateErrorPrototype(Realm&);
 };
 
 }

+ 2 - 2
Userland/Libraries/LibJS/Runtime/ArgumentsObject.h

@@ -16,8 +16,6 @@ class ArgumentsObject final : public Object {
     JS_OBJECT(ArgumentsObject, Object);
 
 public:
-    ArgumentsObject(Realm&, Environment&);
-
     virtual void initialize(Realm&) override;
     virtual ~ArgumentsObject() override = default;
 
@@ -33,6 +31,8 @@ public:
     Object& parameter_map() { return *m_parameter_map; }
 
 private:
+    ArgumentsObject(Realm&, Environment&);
+
     virtual void visit_edges(Cell::Visitor&) override;
 
     Environment& m_environment;

+ 3 - 0
Userland/Libraries/LibJS/Runtime/Array.h

@@ -44,6 +44,9 @@ public:
 
     [[nodiscard]] bool length_is_writable() const { return m_length_writable; };
 
+protected:
+    explicit Array(Object& prototype);
+
 private:
     ThrowCompletionOr<bool> set_length(PropertyDescriptor const&);
 

+ 3 - 2
Userland/Libraries/LibJS/Runtime/ArrayBuffer.h

@@ -29,8 +29,6 @@ public:
     static ArrayBuffer* create(Realm&, ByteBuffer);
     static ArrayBuffer* create(Realm&, ByteBuffer*);
 
-    ArrayBuffer(ByteBuffer buffer, Object& prototype);
-    ArrayBuffer(ByteBuffer* buffer, Object& prototype);
     virtual ~ArrayBuffer() override = default;
 
     size_t byte_length() const { return buffer_impl().size(); }
@@ -58,6 +56,9 @@ public:
     Value get_modify_set_value(size_t byte_index, Value value, ReadWriteModifyFunction operation, bool is_little_endian = true);
 
 private:
+    ArrayBuffer(ByteBuffer buffer, Object& prototype);
+    ArrayBuffer(ByteBuffer* buffer, Object& prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     ByteBuffer& buffer_impl()

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ArrayBufferConstructor.h

@@ -14,7 +14,6 @@ class ArrayBufferConstructor final : public NativeFunction {
     JS_OBJECT(ArrayBufferConstructor, NativeFunction);
 
 public:
-    explicit ArrayBufferConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ArrayBufferConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit ArrayBufferConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(is_view);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ArrayBufferPrototype.h

@@ -15,11 +15,12 @@ class ArrayBufferPrototype final : public PrototypeObject<ArrayBufferPrototype,
     JS_PROTOTYPE_OBJECT(ArrayBufferPrototype, ArrayBuffer, ArrayBuffer);
 
 public:
-    explicit ArrayBufferPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ArrayBufferPrototype() override = default;
 
 private:
+    explicit ArrayBufferPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(slice);
     JS_DECLARE_NATIVE_FUNCTION(byte_length_getter);
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ArrayConstructor.h

@@ -14,7 +14,6 @@ class ArrayConstructor final : public NativeFunction {
     JS_OBJECT(ArrayConstructor, NativeFunction);
 
 public:
-    explicit ArrayConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ArrayConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit ArrayConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(from);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ArrayIterator.h

@@ -16,7 +16,6 @@ class ArrayIterator final : public Object {
 public:
     static ArrayIterator* create(Realm&, Value array, Object::PropertyKind iteration_kind);
 
-    explicit ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype);
     virtual ~ArrayIterator() override = default;
 
     Value array() const { return m_array; }
@@ -26,6 +25,8 @@ public:
 private:
     friend class ArrayIteratorPrototype;
 
+    ArrayIterator(Value array, Object::PropertyKind iteration_kind, Object& prototype);
+
     virtual void visit_edges(Cell::Visitor&) override;
 
     Value m_array;

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ArrayIteratorPrototype.h

@@ -15,11 +15,12 @@ class ArrayIteratorPrototype final : public PrototypeObject<ArrayIteratorPrototy
     JS_PROTOTYPE_OBJECT(ArrayIteratorPrototype, ArrayIterator, ArrayIterator);
 
 public:
-    ArrayIteratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ArrayIteratorPrototype() override = default;
 
 private:
+    explicit ArrayIteratorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(next);
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ArrayPrototype.h

@@ -15,11 +15,12 @@ class ArrayPrototype final : public Array {
     JS_OBJECT(ArrayPrototype, Array);
 
 public:
-    ArrayPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ArrayPrototype() override = default;
 
 private:
+    explicit ArrayPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(at);
     JS_DECLARE_NATIVE_FUNCTION(concat);
     JS_DECLARE_NATIVE_FUNCTION(copy_within);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncFromSyncIterator.h

@@ -19,7 +19,6 @@ class AsyncFromSyncIterator final : public Object {
 public:
     static AsyncFromSyncIterator* create(Realm&, Iterator sync_iterator_record);
 
-    explicit AsyncFromSyncIterator(Realm&, Iterator sync_iterator_record);
     virtual void initialize(Realm&) override;
     virtual ~AsyncFromSyncIterator() override = default;
 
@@ -29,6 +28,8 @@ public:
     Iterator const& sync_iterator_record() const { return m_sync_iterator_record; }
 
 private:
+    AsyncFromSyncIterator(Realm&, Iterator sync_iterator_record);
+
     Iterator m_sync_iterator_record; // [[SyncIteratorRecord]]
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncFromSyncIteratorPrototype.h

@@ -19,11 +19,12 @@ class AsyncFromSyncIteratorPrototype final : public PrototypeObject<AsyncFromSyn
     JS_PROTOTYPE_OBJECT(AsyncFromSyncIteratorPrototype, AsyncFromSyncIterator, AsyncFromSyncIterator);
 
 public:
-    explicit AsyncFromSyncIteratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncFromSyncIteratorPrototype() override = default;
 
 private:
+    explicit AsyncFromSyncIteratorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(next);
     JS_DECLARE_NATIVE_FUNCTION(return_);
     JS_DECLARE_NATIVE_FUNCTION(throw_);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncFunctionConstructor.h

@@ -15,7 +15,6 @@ class AsyncFunctionConstructor final : public NativeFunction {
     JS_OBJECT(AsyncFunctionConstructor, NativeFunction);
 
 public:
-    explicit AsyncFunctionConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncFunctionConstructor() override = default;
 
@@ -23,6 +22,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit AsyncFunctionConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncFunctionDriverWrapper.h

@@ -19,7 +19,6 @@ class AsyncFunctionDriverWrapper final : public Promise {
 
 public:
     static ThrowCompletionOr<Value> create(Realm&, GeneratorObject*);
-    explicit AsyncFunctionDriverWrapper(Realm&, GeneratorObject*);
 
     virtual ~AsyncFunctionDriverWrapper() override = default;
     void visit_edges(Cell::Visitor&) override;
@@ -27,6 +26,8 @@ public:
     ThrowCompletionOr<Value> react_to_async_task_completion(VM&, Value, bool is_successful);
 
 private:
+    AsyncFunctionDriverWrapper(Realm&, GeneratorObject*);
+
     GeneratorObject* m_generator_object { nullptr };
     NativeFunction* m_on_fulfillment { nullptr };
     NativeFunction* m_on_rejection { nullptr };

+ 3 - 1
Userland/Libraries/LibJS/Runtime/AsyncFunctionPrototype.h

@@ -14,9 +14,11 @@ class AsyncFunctionPrototype final : public Object {
     JS_OBJECT(AsyncFunctionPrototype, Object);
 
 public:
-    explicit AsyncFunctionPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncFunctionPrototype() override = default;
+
+private:
+    explicit AsyncFunctionPrototype(Realm&);
 };
 
 }

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncGenerator.h

@@ -26,10 +26,11 @@ public:
         Completed,
     };
 
-    explicit AsyncGenerator(Object& prototype);
     virtual ~AsyncGenerator() override = default;
 
 private:
+    explicit AsyncGenerator(Object& prototype);
+
     virtual void visit_edges(Cell::Visitor&) override;
 
     // At the time of constructing an AsyncGenerator, we still need to point to an

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionConstructor.h

@@ -14,7 +14,6 @@ class AsyncGeneratorFunctionConstructor final : public NativeFunction {
     JS_OBJECT(AsyncGeneratorFunctionConstructor, NativeFunction);
 
 public:
-    explicit AsyncGeneratorFunctionConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncGeneratorFunctionConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit AsyncGeneratorFunctionConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 3 - 1
Userland/Libraries/LibJS/Runtime/AsyncGeneratorFunctionPrototype.h

@@ -14,9 +14,11 @@ class AsyncGeneratorFunctionPrototype final : public PrototypeObject<AsyncGenera
     JS_PROTOTYPE_OBJECT(AsyncGeneratorFunctionPrototype, AsyncGeneratorFunction, AsyncGeneratorFunction);
 
 public:
-    explicit AsyncGeneratorFunctionPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncGeneratorFunctionPrototype() override = default;
+
+private:
+    explicit AsyncGeneratorFunctionPrototype(Realm&);
 };
 
 }

+ 3 - 1
Userland/Libraries/LibJS/Runtime/AsyncGeneratorPrototype.h

@@ -15,9 +15,11 @@ class AsyncGeneratorPrototype final : public PrototypeObject<AsyncGeneratorProto
     JS_PROTOTYPE_OBJECT(AsyncGeneratorPrototype, AsyncGenerator, AsyncGenerator)
 
 public:
-    explicit AsyncGeneratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncGeneratorPrototype() override = default;
+
+private:
+    explicit AsyncGeneratorPrototype(Realm&);
 };
 
 }

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AsyncIteratorPrototype.h

@@ -14,11 +14,12 @@ class AsyncIteratorPrototype final : public Object {
     JS_OBJECT(AsyncIteratorPrototype, Object)
 
 public:
-    explicit AsyncIteratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AsyncIteratorPrototype() override = default;
 
 private:
+    explicit AsyncIteratorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(symbol_async_iterator);
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/AtomicsObject.h

@@ -14,11 +14,12 @@ class AtomicsObject : public Object {
     JS_OBJECT(AtomicsObject, Object);
 
 public:
-    explicit AtomicsObject(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~AtomicsObject() override = default;
 
 private:
+    explicit AtomicsObject(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(add);
     JS_DECLARE_NATIVE_FUNCTION(and_);
     JS_DECLARE_NATIVE_FUNCTION(compare_exchange);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BigInt.h

@@ -16,13 +16,14 @@ class BigInt final : public Cell {
     JS_CELL(BigInt, Cell);
 
 public:
-    explicit BigInt(Crypto::SignedBigInteger);
     virtual ~BigInt() override = default;
 
     Crypto::SignedBigInteger const& big_integer() const { return m_big_integer; }
     const String to_string() const { return String::formatted("{}n", m_big_integer.to_base(10)); }
 
 private:
+    explicit BigInt(Crypto::SignedBigInteger);
+
     Crypto::SignedBigInteger m_big_integer;
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BigIntConstructor.h

@@ -14,7 +14,6 @@ class BigIntConstructor final : public NativeFunction {
     JS_OBJECT(BigIntConstructor, NativeFunction);
 
 public:
-    explicit BigIntConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~BigIntConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit BigIntConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(as_int_n);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BigIntObject.h

@@ -17,13 +17,14 @@ class BigIntObject final : public Object {
 public:
     static BigIntObject* create(Realm&, BigInt&);
 
-    BigIntObject(BigInt&, Object& prototype);
     virtual ~BigIntObject() override = default;
 
     BigInt const& bigint() const { return m_bigint; }
     BigInt& bigint() { return m_bigint; }
 
 private:
+    BigIntObject(BigInt&, Object& prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     BigInt& m_bigint;

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BigIntPrototype.h

@@ -14,11 +14,12 @@ class BigIntPrototype final : public Object {
     JS_OBJECT(BigIntPrototype, Object);
 
 public:
-    explicit BigIntPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~BigIntPrototype() override = default;
 
 private:
+    explicit BigIntPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(to_string);
     JS_DECLARE_NATIVE_FUNCTION(to_locale_string);
     JS_DECLARE_NATIVE_FUNCTION(value_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BooleanConstructor.h

@@ -14,7 +14,6 @@ class BooleanConstructor final : public NativeFunction {
     JS_OBJECT(BooleanConstructor, NativeFunction);
 
 public:
-    explicit BooleanConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~BooleanConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit BooleanConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 3 - 1
Userland/Libraries/LibJS/Runtime/BooleanObject.h

@@ -16,11 +16,13 @@ class BooleanObject : public Object {
 public:
     static BooleanObject* create(Realm&, bool);
 
-    BooleanObject(bool, Object& prototype);
     virtual ~BooleanObject() override = default;
 
     bool boolean() const { return m_value; }
 
+protected:
+    BooleanObject(bool, Object& prototype);
+
 private:
     bool m_value { false };
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BooleanPrototype.h

@@ -14,11 +14,12 @@ class BooleanPrototype final : public BooleanObject {
     JS_OBJECT(BooleanPrototype, BooleanObject);
 
 public:
-    explicit BooleanPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~BooleanPrototype() override = default;
 
 private:
+    explicit BooleanPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(to_string);
     JS_DECLARE_NATIVE_FUNCTION(value_of);
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/BoundFunction.h

@@ -17,7 +17,6 @@ class BoundFunction final : public FunctionObject {
 public:
     static ThrowCompletionOr<BoundFunction*> create(Realm&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments);
 
-    BoundFunction(Realm&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype);
     virtual ~BoundFunction() override = default;
 
     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override;
@@ -32,6 +31,8 @@ public:
     Vector<Value> const& bound_arguments() const { return m_bound_arguments; }
 
 private:
+    BoundFunction(Realm&, FunctionObject& target_function, Value bound_this, Vector<Value> bound_arguments, Object* prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     FunctionObject* m_bound_target_function { nullptr }; // [[BoundTargetFunction]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ConsoleObject.h

@@ -14,13 +14,14 @@ class ConsoleObject final : public Object {
     JS_OBJECT(ConsoleObject, Object);
 
 public:
-    explicit ConsoleObject(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ConsoleObject() override = default;
 
     Console& console() { return *m_console; }
 
 private:
+    explicit ConsoleObject(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(log);
     JS_DECLARE_NATIVE_FUNCTION(debug);
     JS_DECLARE_NATIVE_FUNCTION(info);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/DataView.h

@@ -18,7 +18,6 @@ class DataView : public Object {
 public:
     static DataView* create(Realm&, ArrayBuffer*, size_t byte_length, size_t byte_offset);
 
-    explicit DataView(ArrayBuffer*, size_t byte_length, size_t byte_offset, Object& prototype);
     virtual ~DataView() override = default;
 
     ArrayBuffer* viewed_array_buffer() const { return m_viewed_array_buffer; }
@@ -26,6 +25,8 @@ public:
     size_t byte_offset() const { return m_byte_offset; }
 
 private:
+    DataView(ArrayBuffer*, size_t byte_length, size_t byte_offset, Object& prototype);
+
     virtual void visit_edges(Visitor& visitor) override;
 
     ArrayBuffer* m_viewed_array_buffer { nullptr };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/DataViewConstructor.h

@@ -14,7 +14,6 @@ class DataViewConstructor final : public NativeFunction {
     JS_OBJECT(DataViewConstructor, NativeFunction);
 
 public:
-    explicit DataViewConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DataViewConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject&) override;
 
 private:
+    explicit DataViewConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/DataViewPrototype.h

@@ -15,11 +15,12 @@ class DataViewPrototype final : public PrototypeObject<DataViewPrototype, DataVi
     JS_PROTOTYPE_OBJECT(DataViewPrototype, DataView, DataView);
 
 public:
-    DataViewPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DataViewPrototype() override = default;
 
 private:
+    explicit DataViewPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(get_big_int_64);
     JS_DECLARE_NATIVE_FUNCTION(get_big_uint_64);
     JS_DECLARE_NATIVE_FUNCTION(get_float_32);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Date.h

@@ -18,7 +18,6 @@ public:
     static Date* create(Realm&, double date_value);
     static Date* now(VM&);
 
-    Date(double date_value, Object& prototype);
     virtual ~Date() override = default;
 
     double date_value() const { return m_date_value; }
@@ -27,6 +26,8 @@ public:
     String iso_date_string() const;
 
 private:
+    Date(double date_value, Object& prototype);
+
     double m_date_value { 0 }; // [[DateValue]]
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/DateConstructor.h

@@ -14,7 +14,6 @@ class DateConstructor final : public NativeFunction {
     JS_OBJECT(DateConstructor, NativeFunction);
 
 public:
-    explicit DateConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DateConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit DateConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(now);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/DatePrototype.h

@@ -15,11 +15,12 @@ class DatePrototype final : public PrototypeObject<DatePrototype, Date> {
     JS_PROTOTYPE_OBJECT(DatePrototype, Date, Date);
 
 public:
-    explicit DatePrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DatePrototype() override = default;
 
 private:
+    explicit DatePrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(get_date);
     JS_DECLARE_NATIVE_FUNCTION(get_day);
     JS_DECLARE_NATIVE_FUNCTION(get_full_year);

+ 4 - 3
Userland/Libraries/LibJS/Runtime/DeclarativeEnvironment.h

@@ -29,9 +29,6 @@ class DeclarativeEnvironment : public Environment {
 public:
     static DeclarativeEnvironment* create_for_per_iteration_bindings(Badge<ForStatement>, DeclarativeEnvironment& other, size_t bindings_size);
 
-    DeclarativeEnvironment();
-    explicit DeclarativeEnvironment(Environment* parent_environment);
-    explicit DeclarativeEnvironment(Environment* parent_environment, Span<Binding const> bindings);
     virtual ~DeclarativeEnvironment() override = default;
 
     virtual ThrowCompletionOr<bool> has_binding(FlyString const& name, Optional<size_t>* = nullptr) const override;
@@ -62,6 +59,10 @@ public:
     ThrowCompletionOr<void> set_mutable_binding_direct(VM&, size_t index, Value, bool strict);
 
 protected:
+    DeclarativeEnvironment();
+    explicit DeclarativeEnvironment(Environment* parent_environment);
+    DeclarativeEnvironment(Environment* parent_environment, Span<Binding const> bindings);
+
     virtual void visit_edges(Visitor&) override;
 
 private:

+ 2 - 1
Userland/Libraries/LibJS/Runtime/ECMAScriptFunctionObject.h

@@ -35,7 +35,6 @@ public:
     static ECMAScriptFunctionObject* create(Realm&, FlyString name, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind, bool is_strict, bool might_need_arguments_object = true, bool contains_direct_call_to_eval = true, bool is_arrow_function = false, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name = {});
     static ECMAScriptFunctionObject* create(Realm&, FlyString name, Object& prototype, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind, bool is_strict, bool might_need_arguments_object = true, bool contains_direct_call_to_eval = true, bool is_arrow_function = false, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name = {});
 
-    ECMAScriptFunctionObject(FlyString name, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind, bool is_strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name);
     virtual void initialize(Realm&) override;
     virtual ~ECMAScriptFunctionObject() override = default;
 
@@ -94,6 +93,8 @@ protected:
     virtual Completion ordinary_call_evaluate_body();
 
 private:
+    ECMAScriptFunctionObject(FlyString name, String source_text, Statement const& ecmascript_code, Vector<FunctionNode::Parameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind, bool is_strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name);
+
     virtual bool is_ecmascript_function_object() const override { return true; }
     virtual void visit_edges(Visitor&) override;
 

+ 3 - 1
Userland/Libraries/LibJS/Runtime/Error.h

@@ -26,7 +26,6 @@ public:
     static Error* create(Realm&);
     static Error* create(Realm&, String const& message);
 
-    explicit Error(Object& prototype);
     virtual ~Error() override = default;
 
     [[nodiscard]] String stack_string() const;
@@ -35,6 +34,9 @@ public:
 
     Vector<TracebackFrame, 32> const& traceback() const { return m_traceback; }
 
+protected:
+    explicit Error(Object& prototype);
+
 private:
     void populate_stack();
     Vector<TracebackFrame, 32> m_traceback;

+ 8 - 3
Userland/Libraries/LibJS/Runtime/ErrorConstructor.h

@@ -15,7 +15,6 @@ class ErrorConstructor final : public NativeFunction {
     JS_OBJECT(ErrorConstructor, NativeFunction);
 
 public:
-    explicit ErrorConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ErrorConstructor() override = default;
 
@@ -23,6 +22,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit ErrorConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 
@@ -31,14 +32,18 @@ private:
         JS_OBJECT(ConstructorName, NativeFunction);                                             \
                                                                                                 \
     public:                                                                                     \
-        explicit ConstructorName(Realm&);                                                       \
         virtual void initialize(Realm&) override;                                               \
         virtual ~ConstructorName() override;                                                    \
         virtual ThrowCompletionOr<Value> call() override;                                       \
         virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;      \
                                                                                                 \
     private:                                                                                    \
-        virtual bool has_constructor() const override { return true; }                          \
+        explicit ConstructorName(Realm&);                                                       \
+                                                                                                \
+        virtual bool has_constructor() const override                                           \
+        {                                                                                       \
+            return true;                                                                        \
+        }                                                                                       \
     };
 
 #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \

+ 5 - 2
Userland/Libraries/LibJS/Runtime/ErrorPrototype.h

@@ -16,11 +16,12 @@ class ErrorPrototype final : public PrototypeObject<ErrorPrototype, Error> {
     JS_PROTOTYPE_OBJECT(ErrorPrototype, Error, Error);
 
 public:
-    explicit ErrorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ErrorPrototype() override = default;
 
 private:
+    explicit ErrorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(to_string);
     JS_DECLARE_NATIVE_FUNCTION(stack_getter);
     JS_DECLARE_NATIVE_FUNCTION(stack_setter);
@@ -31,9 +32,11 @@ private:
         JS_PROTOTYPE_OBJECT(PrototypeName, ClassName, ClassName);                             \
                                                                                               \
     public:                                                                                   \
-        explicit PrototypeName(Realm&);                                                       \
         virtual void initialize(Realm&) override;                                             \
         virtual ~PrototypeName() override = default;                                          \
+                                                                                              \
+    private:                                                                                  \
+        explicit PrototypeName(Realm&);                                                       \
     };
 
 #define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \

+ 2 - 1
Userland/Libraries/LibJS/Runtime/FinalizationRegistry.h

@@ -22,7 +22,6 @@ class FinalizationRegistry final
     JS_OBJECT(FinalizationRegistry, Object);
 
 public:
-    explicit FinalizationRegistry(Realm&, JobCallback, Object& prototype);
     virtual ~FinalizationRegistry() override = default;
 
     void add_finalization_record(Cell& target, Value held_value, Cell* unregister_token);
@@ -38,6 +37,8 @@ public:
     JobCallback const& cleanup_callback() const { return m_cleanup_callback; }
 
 private:
+    FinalizationRegistry(Realm&, JobCallback, Object& prototype);
+
     virtual void visit_edges(Visitor& visitor) override;
 
     Handle<Realm> m_realm;

+ 2 - 1
Userland/Libraries/LibJS/Runtime/FinalizationRegistryConstructor.h

@@ -14,7 +14,6 @@ class FinalizationRegistryConstructor final : public NativeFunction {
     JS_OBJECT(FinalizationRegistryConstructor, NativeFunction);
 
 public:
-    explicit FinalizationRegistryConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~FinalizationRegistryConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject&) override;
 
 private:
+    explicit FinalizationRegistryConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/FinalizationRegistryPrototype.h

@@ -15,11 +15,12 @@ class FinalizationRegistryPrototype final : public PrototypeObject<FinalizationR
     JS_PROTOTYPE_OBJECT(FinalizationRegistryPrototype, FinalizationRegistry, FinalizationRegistry);
 
 public:
-    FinalizationRegistryPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~FinalizationRegistryPrototype() override = default;
 
 private:
+    explicit FinalizationRegistryPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(cleanup_some);
     JS_DECLARE_NATIVE_FUNCTION(register_);
     JS_DECLARE_NATIVE_FUNCTION(unregister);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/FunctionConstructor.h

@@ -17,7 +17,6 @@ class FunctionConstructor final : public NativeFunction {
 public:
     static ThrowCompletionOr<ECMAScriptFunctionObject*> create_dynamic_function(VM&, FunctionObject& constructor, FunctionObject* new_target, FunctionKind kind, MarkedVector<Value> const& args);
 
-    explicit FunctionConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~FunctionConstructor() override = default;
 
@@ -25,6 +24,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit FunctionConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/FunctionEnvironment.h

@@ -22,7 +22,6 @@ public:
         Uninitialized,
     };
 
-    explicit FunctionEnvironment(Environment* parent_environment);
     virtual ~FunctionEnvironment() override = default;
 
     ThisBindingStatus this_binding_status() const { return m_this_binding_status; }
@@ -47,6 +46,8 @@ public:
     ThrowCompletionOr<Value> bind_this_value(VM&, Value);
 
 private:
+    explicit FunctionEnvironment(Environment* parent_environment);
+
     virtual bool is_function_environment() const override { return true; }
     virtual void visit_edges(Visitor&) override;
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/FunctionPrototype.h

@@ -14,7 +14,6 @@ class FunctionPrototype final : public FunctionObject {
     JS_OBJECT(FunctionPrototype, FunctionObject);
 
 public:
-    explicit FunctionPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~FunctionPrototype() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual FlyString const& name() const override { return m_name; }
 
 private:
+    explicit FunctionPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(apply);
     JS_DECLARE_NATIVE_FUNCTION(bind);
     JS_DECLARE_NATIVE_FUNCTION(call);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/GeneratorFunctionConstructor.h

@@ -15,7 +15,6 @@ class GeneratorFunctionConstructor final : public NativeFunction {
     JS_OBJECT(GeneratorFunctionConstructor, NativeFunction);
 
 public:
-    explicit GeneratorFunctionConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~GeneratorFunctionConstructor() override = default;
 
@@ -23,6 +22,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit GeneratorFunctionConstructor(Realm&);
+
     bool has_constructor() const override { return true; }
 };
 

+ 3 - 1
Userland/Libraries/LibJS/Runtime/GeneratorFunctionPrototype.h

@@ -16,9 +16,11 @@ class GeneratorFunctionPrototype final : public Object {
     JS_OBJECT(GeneratorFunctionPrototype, Object);
 
 public:
-    explicit GeneratorFunctionPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~GeneratorFunctionPrototype() override = default;
+
+private:
+    explicit GeneratorFunctionPrototype(Realm&);
 };
 
 }

+ 2 - 1
Userland/Libraries/LibJS/Runtime/GeneratorObject.h

@@ -17,7 +17,6 @@ class GeneratorObject final : public Object {
 
 public:
     static ThrowCompletionOr<GeneratorObject*> create(Realm&, Value, ECMAScriptFunctionObject*, ExecutionContext, Bytecode::RegisterWindow);
-    GeneratorObject(Realm&, Object& prototype, ExecutionContext);
     virtual void initialize(Realm&) override;
     virtual ~GeneratorObject() override = default;
     void visit_edges(Cell::Visitor&) override;
@@ -26,6 +25,8 @@ public:
     void set_done() { m_done = true; }
 
 private:
+    GeneratorObject(Realm&, Object& prototype, ExecutionContext);
+
     ExecutionContext m_execution_context;
     ECMAScriptFunctionObject* m_generating_function { nullptr };
     Value m_previous_value;

+ 2 - 1
Userland/Libraries/LibJS/Runtime/GeneratorPrototype.h

@@ -16,11 +16,12 @@ class GeneratorPrototype final : public PrototypeObject<GeneratorPrototype, Gene
     JS_PROTOTYPE_OBJECT(GeneratorPrototype, GeneratorObject, Generator);
 
 public:
-    explicit GeneratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~GeneratorPrototype() override = default;
 
 private:
+    explicit GeneratorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(next);
     JS_DECLARE_NATIVE_FUNCTION(return_);
     JS_DECLARE_NATIVE_FUNCTION(throw_);

+ 2 - 2
Userland/Libraries/LibJS/Runtime/GlobalEnvironment.h

@@ -14,8 +14,6 @@ class GlobalEnvironment final : public Environment {
     JS_ENVIRONMENT(GlobalEnvironment, Environment);
 
 public:
-    GlobalEnvironment(Object&, Object& this_value);
-
     virtual bool has_this_binding() const final { return true; }
     virtual ThrowCompletionOr<Value> get_this_binding(VM&) const final;
 
@@ -40,6 +38,8 @@ public:
     ThrowCompletionOr<void> create_global_function_binding(FlyString const& name, Value, bool can_be_deleted);
 
 private:
+    GlobalEnvironment(Object&, Object& this_value);
+
     virtual bool is_global_environment() const override { return true; }
     virtual void visit_edges(Visitor&) override;
 

+ 3 - 1
Userland/Libraries/LibJS/Runtime/GlobalObject.h

@@ -19,10 +19,12 @@ class GlobalObject : public Object {
     friend class Intrinsics;
 
 public:
-    explicit GlobalObject(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~GlobalObject() override;
 
+protected:
+    explicit GlobalObject(Realm&);
+
 private:
     virtual bool is_global_object() const final { return true; }
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/Collator.h

@@ -43,7 +43,6 @@ public:
         return AK::Array { "co"sv, "kf"sv, "kn"sv };
     }
 
-    explicit Collator(Object& prototype);
     virtual ~Collator() override = default;
 
     String const& locale() const { return m_locale; }
@@ -74,6 +73,8 @@ public:
     void set_bound_compare(CollatorCompareFunction* bound_compare) { m_bound_compare = bound_compare; }
 
 private:
+    explicit Collator(Object& prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     String m_locale;                                      // [[Locale]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/CollatorCompareFunction.h

@@ -16,13 +16,14 @@ class CollatorCompareFunction : public NativeFunction {
 public:
     static CollatorCompareFunction* create(Realm&, Collator&);
 
-    CollatorCompareFunction(Realm&, Collator&);
     virtual void initialize(Realm&) override;
     virtual ~CollatorCompareFunction() override = default;
 
     virtual ThrowCompletionOr<Value> call() override;
 
 private:
+    CollatorCompareFunction(Realm&, Collator&);
+
     virtual void visit_edges(Visitor&) override;
 
     Collator& m_collator; // [[Collator]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/CollatorConstructor.h

@@ -14,7 +14,6 @@ class CollatorConstructor final : public NativeFunction {
     JS_OBJECT(CollatorConstructor, NativeFunction);
 
 public:
-    explicit CollatorConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~CollatorConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit CollatorConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/CollatorPrototype.h

@@ -15,11 +15,12 @@ class CollatorPrototype final : public PrototypeObject<CollatorPrototype, Collat
     JS_PROTOTYPE_OBJECT(CollatorPrototype, Collator, Collator);
 
 public:
-    explicit CollatorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~CollatorPrototype() override = default;
 
 private:
+    explicit CollatorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(compare_getter);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormat.h

@@ -41,7 +41,6 @@ public:
         return AK::Array { "ca"sv, "hc"sv, "nu"sv };
     }
 
-    DateTimeFormat(Object& prototype);
     virtual ~DateTimeFormat() override = default;
 
     String const& locale() const { return m_locale; }
@@ -128,6 +127,8 @@ public:
     void set_bound_format(NativeFunction* bound_format) { m_bound_format = bound_format; }
 
 private:
+    DateTimeFormat(Object& prototype);
+
     static Style style_from_string(StringView style);
     static StringView style_to_string(Style style);
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatConstructor.h

@@ -14,7 +14,6 @@ class DateTimeFormatConstructor final : public NativeFunction {
     JS_OBJECT(DateTimeFormatConstructor, NativeFunction);
 
 public:
-    explicit DateTimeFormatConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DateTimeFormatConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit DateTimeFormatConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatFunction.h

@@ -18,13 +18,14 @@ class DateTimeFormatFunction final : public NativeFunction {
 public:
     static DateTimeFormatFunction* create(Realm&, DateTimeFormat&);
 
-    explicit DateTimeFormatFunction(DateTimeFormat&, Object& prototype);
     virtual ~DateTimeFormatFunction() override = default;
     virtual void initialize(Realm&) override;
 
     virtual ThrowCompletionOr<Value> call() override;
 
 private:
+    explicit DateTimeFormatFunction(DateTimeFormat&, Object& prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     DateTimeFormat& m_date_time_format; // [[DateTimeFormat]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DateTimeFormatPrototype.h

@@ -15,11 +15,12 @@ class DateTimeFormatPrototype final : public PrototypeObject<DateTimeFormatProto
     JS_PROTOTYPE_OBJECT(DateTimeFormatPrototype, DateTimeFormat, Intl.DateTimeFormat);
 
 public:
-    explicit DateTimeFormatPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DateTimeFormatPrototype() override = default;
 
 private:
+    explicit DateTimeFormatPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(format);
     JS_DECLARE_NATIVE_FUNCTION(format_to_parts);
     JS_DECLARE_NATIVE_FUNCTION(format_range);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DisplayNames.h

@@ -39,7 +39,6 @@ class DisplayNames final : public Object {
     };
 
 public:
-    DisplayNames(Object& prototype);
     virtual ~DisplayNames() override = default;
 
     String const& locale() const { return m_locale; }
@@ -63,6 +62,8 @@ public:
     StringView language_display_string() const;
 
 private:
+    DisplayNames(Object& prototype);
+
     String m_locale;                                 // [[Locale]]
     Unicode::Style m_style { Unicode::Style::Long }; // [[Style]]
     Type m_type { Type::Invalid };                   // [[Type]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesConstructor.h

@@ -14,7 +14,6 @@ class DisplayNamesConstructor final : public NativeFunction {
     JS_OBJECT(DisplayNamesConstructor, NativeFunction);
 
 public:
-    explicit DisplayNamesConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DisplayNamesConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit DisplayNamesConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DisplayNamesPrototype.h

@@ -15,11 +15,12 @@ class DisplayNamesPrototype final : public PrototypeObject<DisplayNamesPrototype
     JS_PROTOTYPE_OBJECT(DisplayNamesPrototype, DisplayNames, Intl.DisplayNames);
 
 public:
-    explicit DisplayNamesPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DisplayNamesPrototype() override = default;
 
 private:
+    explicit DisplayNamesPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(of);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DurationFormat.h

@@ -48,7 +48,6 @@ public:
         return AK::Array { "nu"sv };
     }
 
-    explicit DurationFormat(Object& prototype);
     virtual ~DurationFormat() override = default;
 
     void set_locale(String locale) { m_locale = move(locale); }
@@ -148,6 +147,8 @@ public:
     u8 fractional_digits() const { return m_fractional_digits.value(); }
 
 private:
+    explicit DurationFormat(Object& prototype);
+
     static Style style_from_string(StringView style);
     static StringView style_to_string(Style);
     static ValueStyle date_style_from_string(StringView date_style);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DurationFormatConstructor.h

@@ -14,7 +14,6 @@ class DurationFormatConstructor final : public NativeFunction {
     JS_OBJECT(DurationFormatConstructor, NativeFunction);
 
 public:
-    explicit DurationFormatConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DurationFormatConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit DurationFormatConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/DurationFormatPrototype.h

@@ -15,11 +15,12 @@ class DurationFormatPrototype final : public PrototypeObject<DurationFormatProto
     JS_PROTOTYPE_OBJECT(DurationFormatPrototype, DurationFormat, Intl.DurationFormat);
 
 public:
-    explicit DurationFormatPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~DurationFormatPrototype() override = default;
 
 private:
+    explicit DurationFormatPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(format);
     JS_DECLARE_NATIVE_FUNCTION(format_to_parts);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/Intl.h

@@ -14,11 +14,12 @@ class Intl final : public Object {
     JS_OBJECT(Intl, Object);
 
 public:
-    explicit Intl(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~Intl() override = default;
 
 private:
+    explicit Intl(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(get_canonical_locales);
     JS_DECLARE_NATIVE_FUNCTION(supported_values_of);
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/ListFormat.h

@@ -28,7 +28,6 @@ public:
         Unit,
     };
 
-    ListFormat(Object& prototype);
     virtual ~ListFormat() override = default;
 
     String const& locale() const { return m_locale; }
@@ -43,6 +42,8 @@ public:
     StringView style_string() const { return Unicode::style_to_string(m_style); }
 
 private:
+    explicit ListFormat(Object& prototype);
+
     String m_locale;                                 // [[Locale]]
     Type m_type { Type::Invalid };                   // [[Type]]
     Unicode::Style m_style { Unicode::Style::Long }; // [[Style]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/ListFormatConstructor.h

@@ -14,7 +14,6 @@ class ListFormatConstructor final : public NativeFunction {
     JS_OBJECT(ListFormatConstructor, NativeFunction);
 
 public:
-    explicit ListFormatConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ListFormatConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit ListFormatConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/ListFormatPrototype.h

@@ -15,11 +15,12 @@ class ListFormatPrototype final : public PrototypeObject<ListFormatPrototype, Li
     JS_PROTOTYPE_OBJECT(ListFormatPrototype, ListFormat, Intl.ListFormat);
 
 public:
-    explicit ListFormatPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~ListFormatPrototype() override = default;
 
 private:
+    explicit ListFormatPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(format);
     JS_DECLARE_NATIVE_FUNCTION(format_to_parts);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);

+ 3 - 2
Userland/Libraries/LibJS/Runtime/Intl/Locale.h

@@ -34,8 +34,6 @@ public:
         return AK::Array { "ca"sv, "co"sv, "hc"sv, "kf"sv, "kn"sv, "nu"sv };
     }
 
-    Locale(Object& prototype);
-    Locale(Unicode::LocaleID const&, Object& prototype);
     virtual ~Locale() override = default;
 
     String const& locale() const { return m_locale; }
@@ -65,6 +63,9 @@ public:
     void set_numeric(bool numeric) { m_numeric = numeric; }
 
 private:
+    explicit Locale(Object& prototype);
+    Locale(Unicode::LocaleID const&, Object& prototype);
+
     String m_locale;                     // [[Locale]]
     Optional<String> m_calendar;         // [[Calendar]]
     Optional<String> m_case_first;       // [[CaseFirst]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/LocaleConstructor.h

@@ -14,7 +14,6 @@ class LocaleConstructor final : public NativeFunction {
     JS_OBJECT(LocaleConstructor, NativeFunction);
 
 public:
-    explicit LocaleConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~LocaleConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit LocaleConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/LocalePrototype.h

@@ -15,11 +15,12 @@ class LocalePrototype final : public PrototypeObject<LocalePrototype, Locale> {
     JS_PROTOTYPE_OBJECT(LocalePrototype, Locale, Intl.Locale);
 
 public:
-    explicit LocalePrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~LocalePrototype() override = default;
 
 private:
+    explicit LocalePrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(maximize);
     JS_DECLARE_NATIVE_FUNCTION(minimize);
     JS_DECLARE_NATIVE_FUNCTION(to_string);

+ 5 - 2
Userland/Libraries/LibJS/Runtime/Intl/NumberFormat.h

@@ -56,7 +56,6 @@ public:
         StripIfInteger,
     };
 
-    NumberFormatBase(Object& prototype);
     virtual ~NumberFormatBase() override = default;
 
     String const& locale() const { return m_locale; }
@@ -99,6 +98,9 @@ public:
     StringView trailing_zero_display_string() const;
     void set_trailing_zero_display(StringView trailing_zero_display);
 
+protected:
+    explicit NumberFormatBase(Object& prototype);
+
 private:
     String m_locale;                                                              // [[Locale]]
     String m_data_locale;                                                         // [[DataLocale]]
@@ -174,7 +176,6 @@ public:
         return AK::Array { "nu"sv };
     }
 
-    NumberFormat(Object& prototype);
     virtual ~NumberFormat() override = default;
 
     String const& numbering_system() const { return m_numbering_system; }
@@ -233,6 +234,8 @@ public:
     Unicode::NumberFormat compact_format() const { return *m_compact_format; }
 
 private:
+    explicit NumberFormat(Object& prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     String m_locale;                                     // [[Locale]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/NumberFormatConstructor.h

@@ -15,7 +15,6 @@ class NumberFormatConstructor final : public NativeFunction {
     JS_OBJECT(NumberFormatConstructor, NativeFunction);
 
 public:
-    explicit NumberFormatConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~NumberFormatConstructor() override = default;
 
@@ -23,6 +22,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit NumberFormatConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/NumberFormatFunction.h

@@ -18,13 +18,14 @@ class NumberFormatFunction final : public NativeFunction {
 public:
     static NumberFormatFunction* create(Realm&, NumberFormat&);
 
-    explicit NumberFormatFunction(NumberFormat&, Object& prototype);
     virtual ~NumberFormatFunction() override = default;
     virtual void initialize(Realm&) override;
 
     virtual ThrowCompletionOr<Value> call() override;
 
 private:
+    explicit NumberFormatFunction(NumberFormat&, Object& prototype);
+
     virtual void visit_edges(Visitor&) override;
 
     NumberFormat& m_number_format; // [[NumberFormat]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/NumberFormatPrototype.h

@@ -15,11 +15,12 @@ class NumberFormatPrototype final : public PrototypeObject<NumberFormatPrototype
     JS_PROTOTYPE_OBJECT(NumberFormatPrototype, NumberFormat, Intl.NumberFormat);
 
 public:
-    explicit NumberFormatPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~NumberFormatPrototype() override = default;
 
 private:
+    explicit NumberFormatPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(format);
     JS_DECLARE_NATIVE_FUNCTION(format_to_parts);
     JS_DECLARE_NATIVE_FUNCTION(format_range);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/PluralRules.h

@@ -19,7 +19,6 @@ class PluralRules final : public NumberFormatBase {
     JS_OBJECT(PluralRules, NumberFormatBase);
 
 public:
-    PluralRules(Object& prototype);
     virtual ~PluralRules() override = default;
 
     Unicode::PluralForm type() const { return m_type; }
@@ -27,6 +26,8 @@ public:
     void set_type(StringView type) { m_type = Unicode::plural_form_from_string(type); }
 
 private:
+    explicit PluralRules(Object& prototype);
+
     Unicode::PluralForm m_type { Unicode::PluralForm::Cardinal }; // [[Type]]
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/PluralRulesConstructor.h

@@ -14,7 +14,6 @@ class PluralRulesConstructor final : public NativeFunction {
     JS_OBJECT(PluralRulesConstructor, NativeFunction);
 
 public:
-    explicit PluralRulesConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~PluralRulesConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit PluralRulesConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/PluralRulesPrototype.h

@@ -15,11 +15,12 @@ class PluralRulesPrototype final : public PrototypeObject<PluralRulesPrototype,
     JS_PROTOTYPE_OBJECT(PluralRulesPrototype, PluralRules, Intl.PluralRules);
 
 public:
-    explicit PluralRulesPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~PluralRulesPrototype() override = default;
 
 private:
+    explicit PluralRulesPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(select);
     JS_DECLARE_NATIVE_FUNCTION(select_range);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormat.h

@@ -33,7 +33,6 @@ public:
         return AK::Array { "nu"sv };
     }
 
-    RelativeTimeFormat(Object& prototype);
     virtual ~RelativeTimeFormat() override = default;
 
     String const& locale() const { return m_locale; }
@@ -60,6 +59,8 @@ public:
     void set_plural_rules(PluralRules* plural_rules) { m_plural_rules = plural_rules; }
 
 private:
+    explicit RelativeTimeFormat(Object& prototype);
+
     virtual void visit_edges(Cell::Visitor&) override;
 
     String m_locale;                                 // [[Locale]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatConstructor.h

@@ -14,7 +14,6 @@ class RelativeTimeFormatConstructor final : public NativeFunction {
     JS_OBJECT(RelativeTimeFormatConstructor, NativeFunction);
 
 public:
-    explicit RelativeTimeFormatConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~RelativeTimeFormatConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit RelativeTimeFormatConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/RelativeTimeFormatPrototype.h

@@ -15,11 +15,12 @@ class RelativeTimeFormatPrototype final : public PrototypeObject<RelativeTimeFor
     JS_PROTOTYPE_OBJECT(RelativeTimeFormatPrototype, RelativeTimeFormat, Intl.RelativeTimeFormat);
 
 public:
-    explicit RelativeTimeFormatPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~RelativeTimeFormatPrototype() override = default;
 
 private:
+    explicit RelativeTimeFormatPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(format);
     JS_DECLARE_NATIVE_FUNCTION(format_to_parts);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/SegmentIterator.h

@@ -18,7 +18,6 @@ class SegmentIterator final : public Object {
 public:
     static SegmentIterator* create(Realm&, Segmenter&, Utf16View const&, Segments const&);
 
-    SegmentIterator(Realm&, Segmenter&, Utf16View const&, Segments const&);
     virtual ~SegmentIterator() override = default;
 
     Segmenter const& iterating_segmenter() const { return m_iterating_segmenter; }
@@ -29,6 +28,8 @@ public:
     Segments const& segments() { return m_segments; }
 
 private:
+    SegmentIterator(Realm&, Segmenter&, Utf16View const&, Segments const&);
+
     virtual void visit_edges(Cell::Visitor&) override;
 
     Segmenter& m_iterating_segmenter;                            // [[IteratingSegmenter]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/SegmentIteratorPrototype.h

@@ -15,11 +15,12 @@ class SegmentIteratorPrototype final : public PrototypeObject<SegmentIteratorPro
     JS_PROTOTYPE_OBJECT(SegmentIteratorPrototype, SegmentIterator, SegmentIterator);
 
 public:
-    explicit SegmentIteratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~SegmentIteratorPrototype() override = default;
 
 private:
+    explicit SegmentIteratorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(next);
 };
 

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/Segmenter.h

@@ -21,7 +21,6 @@ public:
         Sentence,
     };
 
-    explicit Segmenter(Object& prototype);
     virtual ~Segmenter() override = default;
 
     String const& locale() const { return m_locale; }
@@ -32,6 +31,8 @@ public:
     StringView segmenter_granularity_string() const;
 
 private:
+    explicit Segmenter(Object& prototype);
+
     String m_locale;                                                                 // [[Locale]]
     SegmenterGranularity m_segmenter_granularity { SegmenterGranularity::Grapheme }; // [[SegmenterGranularity]]
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/SegmenterConstructor.h

@@ -14,7 +14,6 @@ class SegmenterConstructor final : public NativeFunction {
     JS_OBJECT(SegmenterConstructor, NativeFunction);
 
 public:
-    explicit SegmenterConstructor(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~SegmenterConstructor() override = default;
 
@@ -22,6 +21,8 @@ public:
     virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
 
 private:
+    explicit SegmenterConstructor(Realm&);
+
     virtual bool has_constructor() const override { return true; }
 
     JS_DECLARE_NATIVE_FUNCTION(supported_locales_of);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/SegmenterPrototype.h

@@ -15,11 +15,12 @@ class SegmenterPrototype final : public PrototypeObject<SegmenterPrototype, Segm
     JS_PROTOTYPE_OBJECT(SegmenterPrototype, Segmenter, Segmenter);
 
 public:
-    explicit SegmenterPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~SegmenterPrototype() override = default;
 
 private:
+    explicit SegmenterPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(segment);
     JS_DECLARE_NATIVE_FUNCTION(resolved_options);
 };

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/Segments.h

@@ -18,7 +18,6 @@ class Segments final : public Object {
 public:
     static Segments* create(Realm&, Segmenter&, Utf16String);
 
-    Segments(Realm&, Segmenter&, Utf16String);
     virtual ~Segments() override = default;
 
     Segmenter& segments_segmenter() const { return m_segments_segmenter; }
@@ -28,6 +27,8 @@ public:
     Optional<Vector<size_t>>& boundaries_cache() const { return m_boundaries_cache; }
 
 private:
+    Segments(Realm&, Segmenter&, Utf16String);
+
     virtual void visit_edges(Cell::Visitor&) override;
 
     Segmenter& m_segments_segmenter; // [[SegmentsSegmenter]]

+ 2 - 1
Userland/Libraries/LibJS/Runtime/Intl/SegmentsPrototype.h

@@ -15,11 +15,12 @@ class SegmentsPrototype final : public PrototypeObject<SegmentsPrototype, Segmen
     JS_PROTOTYPE_OBJECT(SegmentsPrototype, Segments, Segments);
 
 public:
-    explicit SegmentsPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~SegmentsPrototype() override = default;
 
 private:
+    explicit SegmentsPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(containing);
     JS_DECLARE_NATIVE_FUNCTION(symbol_iterator);
 };

+ 2 - 2
Userland/Libraries/LibJS/Runtime/Intrinsics.h

@@ -18,8 +18,6 @@ class Intrinsics final : public Cell {
 public:
     static Intrinsics* create(Realm&);
 
-    Intrinsics() = default;
-
     Shape* empty_object_shape() { return m_empty_object_shape; }
 
     Shape* new_object_shape() { return m_new_object_shape; }
@@ -114,6 +112,8 @@ public:
 #undef __JS_ENUMERATE
 
 private:
+    Intrinsics() = default;
+
     virtual void visit_edges(Visitor&) override;
 
     void initialize_intrinsics(Realm&);

+ 2 - 1
Userland/Libraries/LibJS/Runtime/IteratorPrototype.h

@@ -14,11 +14,12 @@ class IteratorPrototype : public Object {
     JS_OBJECT(IteratorPrototype, Object)
 
 public:
-    IteratorPrototype(Realm&);
     virtual void initialize(Realm&) override;
     virtual ~IteratorPrototype() override = default;
 
 private:
+    IteratorPrototype(Realm&);
+
     JS_DECLARE_NATIVE_FUNCTION(symbol_iterator);
 };
 

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff