diff --git a/Userland/Libraries/LibJS/Runtime/PropertyName.h b/Userland/Libraries/LibJS/Runtime/PropertyName.h index 45bae0f347..68c3223f4b 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyName.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyName.h @@ -43,20 +43,20 @@ public: VERIFY(index >= 0); } - PropertyName(const char* chars) + PropertyName(char const* chars) : m_type(Type::String) , m_string(FlyString(chars)) { } - PropertyName(const String& string) + PropertyName(String const& string) : m_type(Type::String) , m_string(FlyString(string)) { VERIFY(!string.is_null()); } - PropertyName(const FlyString& string) + PropertyName(FlyString const& string) : m_type(Type::String) , m_string(string) { @@ -70,7 +70,7 @@ public: VERIFY(symbol); } - PropertyName(const StringOrSymbol& string_or_symbol) + PropertyName(StringOrSymbol const& string_or_symbol) { if (string_or_symbol.is_string()) { m_string = string_or_symbol.as_string(); @@ -92,13 +92,13 @@ public: return m_number; } - const FlyString& as_string() const + FlyString const& as_string() const { VERIFY(is_string()); return m_string; } - const Symbol* as_symbol() const + Symbol const* as_symbol() const { VERIFY(is_symbol()); return m_symbol; diff --git a/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h b/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h index 52ea30065c..3ee3513efc 100644 --- a/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h +++ b/Userland/Libraries/LibJS/Runtime/StringOrSymbol.h @@ -17,19 +17,19 @@ class StringOrSymbol { public: StringOrSymbol() = default; - StringOrSymbol(const char* chars) + StringOrSymbol(char const* chars) : m_ptr(StringImpl::create(chars).leak_ref()) { } - StringOrSymbol(const String& string) + StringOrSymbol(String const& string) : m_ptr(string.impl()) { VERIFY(!string.is_null()); as_string_impl().ref(); } - StringOrSymbol(const FlyString& string) + StringOrSymbol(FlyString const& string) : m_ptr(string.impl()) { VERIFY(!string.is_null()); @@ -42,13 +42,13 @@ public: as_string_impl().unref(); } - StringOrSymbol(const Symbol* symbol) + StringOrSymbol(Symbol const* symbol) : m_ptr(symbol) { set_symbol_flag(); } - StringOrSymbol(const StringOrSymbol& other) + StringOrSymbol(StringOrSymbol const& other) { m_ptr = other.m_ptr; if (is_string()) @@ -70,10 +70,10 @@ public: return as_string_impl(); } - ALWAYS_INLINE const Symbol* as_symbol() const + ALWAYS_INLINE Symbol const* as_symbol() const { VERIFY(is_symbol()); - return reinterpret_cast(bits() & ~1ul); + return reinterpret_cast(bits() & ~1ul); } String to_display_string() const @@ -100,7 +100,7 @@ public: visitor.visit(const_cast(as_symbol())); } - ALWAYS_INLINE bool operator==(const StringOrSymbol& other) const + ALWAYS_INLINE bool operator==(StringOrSymbol const& other) const { if (is_string()) return other.is_string() && as_string_impl() == other.as_string_impl(); @@ -109,7 +109,7 @@ public: return true; } - StringOrSymbol& operator=(const StringOrSymbol& other) + StringOrSymbol& operator=(StringOrSymbol const& other) { if (this == &other) return *this; @@ -141,23 +141,23 @@ private: ALWAYS_INLINE void set_symbol_flag() { - m_ptr = reinterpret_cast(bits() | 1ul); + m_ptr = reinterpret_cast(bits() | 1ul); } - ALWAYS_INLINE const StringImpl& as_string_impl() const + ALWAYS_INLINE StringImpl const& as_string_impl() const { VERIFY(is_string()); - return *reinterpret_cast(m_ptr); + return *reinterpret_cast(m_ptr); } - const void* m_ptr { nullptr }; + void const* m_ptr { nullptr }; }; } template<> struct AK::Traits : public GenericTraits { - static unsigned hash(const JS::StringOrSymbol& key) + static unsigned hash(JS::StringOrSymbol const& key) { return key.hash(); }