1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:17:44 +00:00

LibJS: Convert Error::create() to NonnullGCPtr

This commit is contained in:
Linus Groh 2022-12-13 20:49:50 +00:00
parent 73efdb1cc4
commit d21ac9d820
5 changed files with 41 additions and 41 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
* Copyright (c) 2021-2022, Linus Groh <linusg@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -23,8 +23,8 @@ class Error : public Object {
JS_OBJECT(Error, Object);
public:
static Error* create(Realm&);
static Error* create(Realm&, DeprecatedString const& message);
static NonnullGCPtr<Error> create(Realm&);
static NonnullGCPtr<Error> create(Realm&, DeprecatedString const& message);
virtual ~Error() override = default;
@ -45,16 +45,16 @@ private:
// NOTE: Making these inherit from Error is not required by the spec but
// our way of implementing the [[ErrorData]] internal slot, which is
// used in Object.prototype.toString().
#define DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName) \
class ClassName final : public Error { \
JS_OBJECT(ClassName, Error); \
\
public: \
static ClassName* create(Realm&); \
static ClassName* create(Realm&, DeprecatedString const& message); \
\
explicit ClassName(Object& prototype); \
virtual ~ClassName() override = default; \
#define DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName) \
class ClassName final : public Error { \
JS_OBJECT(ClassName, Error); \
\
public: \
static NonnullGCPtr<ClassName> create(Realm&); \
static NonnullGCPtr<ClassName> create(Realm&, DeprecatedString const& message); \
\
explicit ClassName(Object& prototype); \
virtual ~ClassName() override = default; \
};
#define __JS_ENUMERATE(ClassName, snake_name, PrototypeName, ConstructorName, ArrayType) \