mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:37:34 +00:00
AK+Everywhere: Rename FlyString to DeprecatedFlyString
DeprecatedFlyString relies heavily on DeprecatedString's StringImpl, so let's rename it to A) match the name of DeprecatedString, B) write a new FlyString class that is tied to String.
This commit is contained in:
parent
2eacc7aec1
commit
f3db548a3d
316 changed files with 1177 additions and 1177 deletions
|
@ -9,17 +9,17 @@
|
|||
|
||||
namespace Web::WebIDL {
|
||||
|
||||
JS::NonnullGCPtr<DOMException> DOMException::create(JS::Realm& realm, FlyString const& name, FlyString const& message)
|
||||
JS::NonnullGCPtr<DOMException> DOMException::create(JS::Realm& realm, DeprecatedFlyString const& name, DeprecatedFlyString const& message)
|
||||
{
|
||||
return realm.heap().allocate<DOMException>(realm, realm, name, message);
|
||||
}
|
||||
|
||||
JS::NonnullGCPtr<DOMException> DOMException::construct_impl(JS::Realm& realm, FlyString const& message, FlyString const& name)
|
||||
JS::NonnullGCPtr<DOMException> DOMException::construct_impl(JS::Realm& realm, DeprecatedFlyString const& message, DeprecatedFlyString const& name)
|
||||
{
|
||||
return realm.heap().allocate<DOMException>(realm, realm, name, message);
|
||||
}
|
||||
|
||||
DOMException::DOMException(JS::Realm& realm, FlyString const& name, FlyString const& message)
|
||||
DOMException::DOMException(JS::Realm& realm, DeprecatedFlyString const& name, DeprecatedFlyString const& message)
|
||||
: PlatformObject(realm)
|
||||
, m_name(name)
|
||||
, m_message(message)
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedFlyString.h>
|
||||
#include <AK/Diagnostics.h>
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
|
@ -79,7 +79,7 @@ namespace Web::WebIDL {
|
|||
__ENUMERATE(OperationError) \
|
||||
__ENUMERATE(NotAllowedError)
|
||||
|
||||
static u16 get_legacy_code_for_name(FlyString const& name)
|
||||
static u16 get_legacy_code_for_name(DeprecatedFlyString const& name)
|
||||
{
|
||||
#define __ENUMERATE(ErrorName, code) \
|
||||
if (name == #ErrorName) \
|
||||
|
@ -94,33 +94,33 @@ class DOMException final : public Bindings::PlatformObject {
|
|||
WEB_PLATFORM_OBJECT(DOMException, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, FlyString const& name, FlyString const& message);
|
||||
static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, DeprecatedFlyString const& name, DeprecatedFlyString const& message);
|
||||
|
||||
// JS constructor has message first, name second
|
||||
// FIXME: This is a completely pointless footgun, let's use the same order for both factories.
|
||||
static JS::NonnullGCPtr<DOMException> construct_impl(JS::Realm& realm, FlyString const& message, FlyString const& name);
|
||||
static JS::NonnullGCPtr<DOMException> construct_impl(JS::Realm& realm, DeprecatedFlyString const& message, DeprecatedFlyString const& name);
|
||||
|
||||
virtual ~DOMException() override;
|
||||
|
||||
FlyString const& name() const { return m_name; }
|
||||
FlyString const& message() const { return m_message; }
|
||||
DeprecatedFlyString const& name() const { return m_name; }
|
||||
DeprecatedFlyString const& message() const { return m_message; }
|
||||
u16 code() const { return get_legacy_code_for_name(m_name); }
|
||||
|
||||
protected:
|
||||
DOMException(JS::Realm&, FlyString const& name, FlyString const& message);
|
||||
DOMException(JS::Realm&, DeprecatedFlyString const& name, DeprecatedFlyString const& message);
|
||||
|
||||
private:
|
||||
FlyString m_name;
|
||||
FlyString m_message;
|
||||
DeprecatedFlyString m_name;
|
||||
DeprecatedFlyString m_message;
|
||||
};
|
||||
|
||||
#define __ENUMERATE(ErrorName) \
|
||||
class ErrorName final { \
|
||||
public: \
|
||||
static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, FlyString const& message) \
|
||||
{ \
|
||||
return DOMException::create(realm, #ErrorName, message); \
|
||||
} \
|
||||
#define __ENUMERATE(ErrorName) \
|
||||
class ErrorName final { \
|
||||
public: \
|
||||
static JS::NonnullGCPtr<DOMException> create(JS::Realm& realm, DeprecatedFlyString const& message) \
|
||||
{ \
|
||||
return DOMException::create(realm, #ErrorName, message); \
|
||||
} \
|
||||
};
|
||||
ENUMERATE_DOM_EXCEPTION_ERROR_NAMES
|
||||
#undef __ENUMERATE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue