diff --git a/Userland/Libraries/LibJS/Runtime/PropertyName.h b/Userland/Libraries/LibJS/Runtime/PropertyName.h index 0c8c79f37dd..c777fc3a3d6 100644 --- a/Userland/Libraries/LibJS/Runtime/PropertyName.h +++ b/Userland/Libraries/LibJS/Runtime/PropertyName.h @@ -74,8 +74,8 @@ public: } PropertyName(FlyString string, StringMayBeNumber string_may_be_number = StringMayBeNumber::Yes) - : m_type(Type::String) - , m_string_may_be_number(string_may_be_number == StringMayBeNumber::Yes) + : m_string_may_be_number(string_may_be_number == StringMayBeNumber::Yes) + , m_type(Type::String) , m_string(move(string)) { VERIFY(!m_string.is_null()); @@ -184,11 +184,11 @@ public: } private: - Type m_type { Type::Invalid }; bool m_string_may_be_number { true }; + Type m_type { Type::Invalid }; + u32 m_number { 0 }; FlyString m_string; Symbol* m_symbol { nullptr }; - u32 m_number { 0 }; }; struct PropertyNameTraits : public Traits { diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 9054837e475..96fb18ce5dc 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -63,18 +63,18 @@ CodePoint code_point_at(Utf16View const& string, size_t position) auto code_point = static_cast(first); if (!Utf16View::is_high_surrogate(first) && !Utf16View::is_low_surrogate(first)) - return { code_point, 1, false }; + return { false, code_point, 1 }; if (Utf16View::is_low_surrogate(first) || (position + 1 == string.length_in_code_units())) - return { code_point, 1, true }; + return { true, code_point, 1 }; auto second = string.code_unit_at(position + 1); if (!Utf16View::is_low_surrogate(second)) - return { code_point, 1, true }; + return { true, code_point, 1 }; code_point = Utf16View::decode_surrogate_pair(first, second); - return { code_point, 2, false }; + return { false, code_point, 2 }; } // 6.1.4.1 StringIndexOf ( string, searchValue, fromIndex ), https://tc39.es/ecma262/#sec-stringindexof diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.h b/Userland/Libraries/LibJS/Runtime/StringPrototype.h index 2282b08531b..50f17bb74ae 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.h +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.h @@ -11,9 +11,9 @@ namespace JS { struct CodePoint { + bool is_unpaired_surrogate { false }; u32 code_point { 0 }; size_t code_unit_count { 0 }; - bool is_unpaired_surrogate { false }; }; CodePoint code_point_at(Utf16View const& string, size_t position);