mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:12:43 +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
				
			
		|  | @ -2,9 +2,9 @@ set(AK_SOURCES | |||
|     Assertions.cpp | ||||
|     Base64.cpp | ||||
|     CircularBuffer.cpp | ||||
|     DeprecatedFlyString.cpp | ||||
|     DeprecatedString.cpp | ||||
|     FloatingPointStringConversions.cpp | ||||
|     FlyString.cpp | ||||
|     Format.cpp | ||||
|     FuzzyMatch.cpp | ||||
|     GenericLexer.cpp | ||||
|  |  | |||
|  | @ -4,8 +4,8 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/HashTable.h> | ||||
| #include <AK/Optional.h> | ||||
| #include <AK/Singleton.h> | ||||
|  | @ -14,7 +14,7 @@ | |||
| 
 | ||||
| namespace AK { | ||||
| 
 | ||||
| struct FlyStringImplTraits : public Traits<StringImpl*> { | ||||
| struct DeprecatedFlyStringImplTraits : public Traits<StringImpl*> { | ||||
|     static unsigned hash(StringImpl const* s) { return s ? s->hash() : 0; } | ||||
|     static bool equals(StringImpl const* a, StringImpl const* b) | ||||
|     { | ||||
|  | @ -24,19 +24,19 @@ struct FlyStringImplTraits : public Traits<StringImpl*> { | |||
|     } | ||||
| }; | ||||
| 
 | ||||
| static Singleton<HashTable<StringImpl*, FlyStringImplTraits>> s_table; | ||||
| static Singleton<HashTable<StringImpl*, DeprecatedFlyStringImplTraits>> s_table; | ||||
| 
 | ||||
| static HashTable<StringImpl*, FlyStringImplTraits>& fly_impls() | ||||
| static HashTable<StringImpl*, DeprecatedFlyStringImplTraits>& fly_impls() | ||||
| { | ||||
|     return *s_table; | ||||
| } | ||||
| 
 | ||||
| void FlyString::did_destroy_impl(Badge<StringImpl>, StringImpl& impl) | ||||
| void DeprecatedFlyString::did_destroy_impl(Badge<StringImpl>, StringImpl& impl) | ||||
| { | ||||
|     fly_impls().remove(&impl); | ||||
| } | ||||
| 
 | ||||
| FlyString::FlyString(DeprecatedString const& string) | ||||
| DeprecatedFlyString::DeprecatedFlyString(DeprecatedString const& string) | ||||
| { | ||||
|     if (string.is_null()) | ||||
|         return; | ||||
|  | @ -55,7 +55,7 @@ FlyString::FlyString(DeprecatedString const& string) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| FlyString::FlyString(StringView string) | ||||
| DeprecatedFlyString::DeprecatedFlyString(StringView string) | ||||
| { | ||||
|     if (string.is_null()) | ||||
|         return; | ||||
|  | @ -74,70 +74,70 @@ FlyString::FlyString(StringView string) | |||
| } | ||||
| 
 | ||||
| template<typename T> | ||||
| Optional<T> FlyString::to_int(TrimWhitespace trim_whitespace) const | ||||
| Optional<T> DeprecatedFlyString::to_int(TrimWhitespace trim_whitespace) const | ||||
| { | ||||
|     return StringUtils::convert_to_int<T>(view(), trim_whitespace); | ||||
| } | ||||
| 
 | ||||
| template Optional<i8> FlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i16> FlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i32> FlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i64> FlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i8> DeprecatedFlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i16> DeprecatedFlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i32> DeprecatedFlyString::to_int(TrimWhitespace) const; | ||||
| template Optional<i64> DeprecatedFlyString::to_int(TrimWhitespace) const; | ||||
| 
 | ||||
| template<typename T> | ||||
| Optional<T> FlyString::to_uint(TrimWhitespace trim_whitespace) const | ||||
| Optional<T> DeprecatedFlyString::to_uint(TrimWhitespace trim_whitespace) const | ||||
| { | ||||
|     return StringUtils::convert_to_uint<T>(view(), trim_whitespace); | ||||
| } | ||||
| 
 | ||||
| template Optional<u8> FlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u16> FlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u32> FlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u64> FlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u8> DeprecatedFlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u16> DeprecatedFlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u32> DeprecatedFlyString::to_uint(TrimWhitespace) const; | ||||
| template Optional<u64> DeprecatedFlyString::to_uint(TrimWhitespace) const; | ||||
| 
 | ||||
| #ifndef KERNEL | ||||
| Optional<double> FlyString::to_double(TrimWhitespace trim_whitespace) const | ||||
| Optional<double> DeprecatedFlyString::to_double(TrimWhitespace trim_whitespace) const | ||||
| { | ||||
|     return StringUtils::convert_to_floating_point<double>(view(), trim_whitespace); | ||||
| } | ||||
| 
 | ||||
| Optional<float> FlyString::to_float(TrimWhitespace trim_whitespace) const | ||||
| Optional<float> DeprecatedFlyString::to_float(TrimWhitespace trim_whitespace) const | ||||
| { | ||||
|     return StringUtils::convert_to_floating_point<float>(view(), trim_whitespace); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| bool FlyString::equals_ignoring_case(StringView other) const | ||||
| bool DeprecatedFlyString::equals_ignoring_case(StringView other) const | ||||
| { | ||||
|     return StringUtils::equals_ignoring_case(view(), other); | ||||
| } | ||||
| 
 | ||||
| bool FlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const | ||||
| bool DeprecatedFlyString::starts_with(StringView str, CaseSensitivity case_sensitivity) const | ||||
| { | ||||
|     return StringUtils::starts_with(view(), str, case_sensitivity); | ||||
| } | ||||
| 
 | ||||
| bool FlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) const | ||||
| bool DeprecatedFlyString::ends_with(StringView str, CaseSensitivity case_sensitivity) const | ||||
| { | ||||
|     return StringUtils::ends_with(view(), str, case_sensitivity); | ||||
| } | ||||
| 
 | ||||
| FlyString FlyString::to_lowercase() const | ||||
| DeprecatedFlyString DeprecatedFlyString::to_lowercase() const | ||||
| { | ||||
|     return DeprecatedString(*m_impl).to_lowercase(); | ||||
| } | ||||
| 
 | ||||
| bool FlyString::operator==(DeprecatedString const& other) const | ||||
| bool DeprecatedFlyString::operator==(DeprecatedString const& other) const | ||||
| { | ||||
|     return m_impl == other.impl() || view() == other.view(); | ||||
| } | ||||
| 
 | ||||
| bool FlyString::operator==(StringView string) const | ||||
| bool DeprecatedFlyString::operator==(StringView string) const | ||||
| { | ||||
|     return view() == string; | ||||
| } | ||||
| 
 | ||||
| bool FlyString::operator==(char const* string) const | ||||
| bool DeprecatedFlyString::operator==(char const* string) const | ||||
| { | ||||
|     return view() == string; | ||||
| } | ||||
|  | @ -11,39 +11,39 @@ | |||
| 
 | ||||
| namespace AK { | ||||
| 
 | ||||
| class FlyString { | ||||
| class DeprecatedFlyString { | ||||
| public: | ||||
|     FlyString() = default; | ||||
|     FlyString(FlyString const& other) | ||||
|     DeprecatedFlyString() = default; | ||||
|     DeprecatedFlyString(DeprecatedFlyString const& other) | ||||
|         : m_impl(other.impl()) | ||||
|     { | ||||
|     } | ||||
|     FlyString(FlyString&& other) | ||||
|     DeprecatedFlyString(DeprecatedFlyString&& other) | ||||
|         : m_impl(move(other.m_impl)) | ||||
|     { | ||||
|     } | ||||
|     FlyString(DeprecatedString const&); | ||||
|     FlyString(StringView); | ||||
|     FlyString(char const* string) | ||||
|         : FlyString(static_cast<DeprecatedString>(string)) | ||||
|     DeprecatedFlyString(DeprecatedString const&); | ||||
|     DeprecatedFlyString(StringView); | ||||
|     DeprecatedFlyString(char const* string) | ||||
|         : DeprecatedFlyString(static_cast<DeprecatedString>(string)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     static FlyString from_fly_impl(NonnullRefPtr<StringImpl> impl) | ||||
|     static DeprecatedFlyString from_fly_impl(NonnullRefPtr<StringImpl> impl) | ||||
|     { | ||||
|         VERIFY(impl->is_fly()); | ||||
|         FlyString string; | ||||
|         DeprecatedFlyString string; | ||||
|         string.m_impl = move(impl); | ||||
|         return string; | ||||
|     } | ||||
| 
 | ||||
|     FlyString& operator=(FlyString const& other) | ||||
|     DeprecatedFlyString& operator=(DeprecatedFlyString const& other) | ||||
|     { | ||||
|         m_impl = other.m_impl; | ||||
|         return *this; | ||||
|     } | ||||
| 
 | ||||
|     FlyString& operator=(FlyString&& other) | ||||
|     DeprecatedFlyString& operator=(DeprecatedFlyString&& other) | ||||
|     { | ||||
|         m_impl = move(other.m_impl); | ||||
|         return *this; | ||||
|  | @ -52,7 +52,7 @@ public: | |||
|     bool is_empty() const { return !m_impl || !m_impl->length(); } | ||||
|     bool is_null() const { return !m_impl; } | ||||
| 
 | ||||
|     bool operator==(FlyString const& other) const { return m_impl == other.m_impl; } | ||||
|     bool operator==(DeprecatedFlyString const& other) const { return m_impl == other.m_impl; } | ||||
| 
 | ||||
|     bool operator==(DeprecatedString const&) const; | ||||
| 
 | ||||
|  | @ -67,7 +67,7 @@ public: | |||
|     ALWAYS_INLINE u32 hash() const { return m_impl ? m_impl->existing_hash() : 0; } | ||||
|     ALWAYS_INLINE StringView view() const { return m_impl ? m_impl->view() : StringView {}; } | ||||
| 
 | ||||
|     FlyString to_lowercase() const; | ||||
|     DeprecatedFlyString to_lowercase() const; | ||||
| 
 | ||||
|     template<typename T = int> | ||||
|     Optional<T> to_int(TrimWhitespace = TrimWhitespace::Yes) const; | ||||
|  | @ -95,12 +95,12 @@ private: | |||
| }; | ||||
| 
 | ||||
| template<> | ||||
| struct Traits<FlyString> : public GenericTraits<FlyString> { | ||||
|     static unsigned hash(FlyString const& s) { return s.hash(); } | ||||
| struct Traits<DeprecatedFlyString> : public GenericTraits<DeprecatedFlyString> { | ||||
|     static unsigned hash(DeprecatedFlyString const& s) { return s.hash(); } | ||||
| }; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| #if USING_AK_GLOBALLY | ||||
| using AK::FlyString; | ||||
| using AK::DeprecatedFlyString; | ||||
| #endif | ||||
|  | @ -5,8 +5,8 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/ByteBuffer.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/Format.h> | ||||
| #include <AK/Function.h> | ||||
| #include <AK/StdLibExtras.h> | ||||
|  | @ -15,7 +15,7 @@ | |||
| 
 | ||||
| namespace AK { | ||||
| 
 | ||||
| bool DeprecatedString::operator==(FlyString const& fly_string) const | ||||
| bool DeprecatedString::operator==(DeprecatedFlyString const& fly_string) const | ||||
| { | ||||
|     return m_impl == fly_string.impl() || view() == fly_string.view(); | ||||
| } | ||||
|  | @ -375,7 +375,7 @@ DeprecatedString escape_html_entities(StringView html) | |||
|     return builder.to_deprecated_string(); | ||||
| } | ||||
| 
 | ||||
| DeprecatedString::DeprecatedString(FlyString const& string) | ||||
| DeprecatedString::DeprecatedString(DeprecatedFlyString const& string) | ||||
|     : m_impl(string.impl()) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ public: | |||
|     { | ||||
|     } | ||||
| 
 | ||||
|     DeprecatedString(FlyString const&); | ||||
|     DeprecatedString(DeprecatedFlyString const&); | ||||
| 
 | ||||
|     [[nodiscard]] static DeprecatedString repeated(char, size_t count); | ||||
|     [[nodiscard]] static DeprecatedString repeated(StringView, size_t count); | ||||
|  | @ -212,7 +212,7 @@ public: | |||
| 
 | ||||
|     bool operator==(StringView) const; | ||||
| 
 | ||||
|     bool operator==(FlyString const&) const; | ||||
|     bool operator==(DeprecatedFlyString const&) const; | ||||
| 
 | ||||
|     bool operator<(DeprecatedString const&) const; | ||||
|     bool operator<(char const*) const; | ||||
|  |  | |||
|  | @ -461,7 +461,7 @@ template<> | |||
| struct Formatter<DeprecatedString> : Formatter<StringView> { | ||||
| }; | ||||
| template<> | ||||
| struct Formatter<FlyString> : Formatter<StringView> { | ||||
| struct Formatter<DeprecatedFlyString> : Formatter<StringView> { | ||||
| }; | ||||
| 
 | ||||
| template<typename T> | ||||
|  |  | |||
|  | @ -27,13 +27,13 @@ class JsonArray; | |||
| class JsonObject; | ||||
| class JsonValue; | ||||
| class StackInfo; | ||||
| class DeprecatedFlyString; | ||||
| class DeprecatedString; | ||||
| class StringBuilder; | ||||
| class StringImpl; | ||||
| class StringView; | ||||
| class Time; | ||||
| class URL; | ||||
| class FlyString; | ||||
| class String; | ||||
| class Utf16View; | ||||
| class Utf32View; | ||||
|  | @ -160,6 +160,7 @@ using AK::Bytes; | |||
| using AK::CircularBuffer; | ||||
| using AK::CircularDuplexStream; | ||||
| using AK::CircularQueue; | ||||
| using AK::DeprecatedFlyString; | ||||
| using AK::DeprecatedString; | ||||
| using AK::DoublyLinkedList; | ||||
| using AK::DuplexMemoryStream; | ||||
|  | @ -167,7 +168,6 @@ using AK::Error; | |||
| using AK::ErrorOr; | ||||
| using AK::FixedArray; | ||||
| using AK::FixedPoint; | ||||
| using AK::FlyString; | ||||
| using AK::Function; | ||||
| using AK::GenericLexer; | ||||
| using AK::HashMap; | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/CharacterTypes.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/HashTable.h> | ||||
| #include <AK/StringHash.h> | ||||
| #include <AK/StringImpl.h> | ||||
|  | @ -32,7 +32,7 @@ StringImpl::StringImpl(ConstructWithInlineBufferTag, size_t length) | |||
| StringImpl::~StringImpl() | ||||
| { | ||||
|     if (m_fly) | ||||
|         FlyString::did_destroy_impl({}, *this); | ||||
|         DeprecatedFlyString::did_destroy_impl({}, *this); | ||||
| } | ||||
| 
 | ||||
| NonnullRefPtr<StringImpl> StringImpl::create_uninitialized(size_t length, char*& buffer) | ||||
|  |  | |||
|  | @ -78,7 +78,7 @@ public: | |||
|     unsigned case_insensitive_hash() const; | ||||
| 
 | ||||
|     bool is_fly() const { return m_fly; } | ||||
|     void set_fly(Badge<FlyString>, bool fly) const { m_fly = fly; } | ||||
|     void set_fly(Badge<DeprecatedFlyString>, bool fly) const { m_fly = fly; } | ||||
| 
 | ||||
| private: | ||||
|     enum ConstructTheEmptyStringImplTag { | ||||
|  |  | |||
|  | @ -13,8 +13,8 @@ | |||
| #include <AK/Vector.h> | ||||
| 
 | ||||
| #ifndef KERNEL | ||||
| #    include <AK/DeprecatedFlyString.h> | ||||
| #    include <AK/DeprecatedString.h> | ||||
| #    include <AK/FlyString.h> | ||||
| #    include <AK/String.h> | ||||
| #endif | ||||
| 
 | ||||
|  | @ -33,7 +33,7 @@ StringView::StringView(DeprecatedString const& string) | |||
| { | ||||
| } | ||||
| 
 | ||||
| StringView::StringView(FlyString const& string) | ||||
| StringView::StringView(DeprecatedFlyString const& string) | ||||
|     : m_characters(string.characters()) | ||||
|     , m_length(string.length()) | ||||
| { | ||||
|  |  | |||
|  | @ -50,14 +50,14 @@ public: | |||
| #ifndef KERNEL | ||||
|     StringView(String const&); | ||||
|     StringView(DeprecatedString const&); | ||||
|     StringView(FlyString const&); | ||||
|     StringView(DeprecatedFlyString const&); | ||||
| #endif | ||||
| 
 | ||||
|     explicit StringView(ByteBuffer&&) = delete; | ||||
| #ifndef KERNEL | ||||
|     explicit StringView(String&&) = delete; | ||||
|     explicit StringView(DeprecatedString&&) = delete; | ||||
|     explicit StringView(FlyString&&) = delete; | ||||
|     explicit StringView(DeprecatedFlyString&&) = delete; | ||||
| #endif | ||||
| 
 | ||||
|     [[nodiscard]] constexpr bool is_null() const | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| #include <LibTest/TestCase.h> | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/StringBuilder.h> | ||||
| #include <AK/Vector.h> | ||||
| #include <cstring> | ||||
|  | @ -145,18 +145,18 @@ TEST_CASE(to_uppercase) | |||
| TEST_CASE(flystring) | ||||
| { | ||||
|     { | ||||
|         FlyString a("foo"); | ||||
|         FlyString b("foo"); | ||||
|         DeprecatedFlyString a("foo"); | ||||
|         DeprecatedFlyString b("foo"); | ||||
|         EXPECT_EQ(a.impl(), b.impl()); | ||||
|     } | ||||
| 
 | ||||
|     { | ||||
|         DeprecatedString a = "foo"; | ||||
|         FlyString b = a; | ||||
|         DeprecatedFlyString b = a; | ||||
|         StringBuilder builder; | ||||
|         builder.append('f'); | ||||
|         builder.append("oo"sv); | ||||
|         FlyString c = builder.to_deprecated_string(); | ||||
|         DeprecatedFlyString c = builder.to_deprecated_string(); | ||||
|         EXPECT_EQ(a.impl(), b.impl()); | ||||
|         EXPECT_EQ(a.impl(), c.impl()); | ||||
|     } | ||||
|  |  | |||
|  | @ -410,7 +410,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path | |||
|             auto const& frame = stack_array.at(i); | ||||
|             auto ptr = frame.to_number<u64>(); | ||||
|             u32 offset = 0; | ||||
|             FlyString object_name; | ||||
|             DeprecatedFlyString object_name; | ||||
|             DeprecatedString symbol; | ||||
| 
 | ||||
|             if (maybe_kernel_base.has_value() && ptr >= maybe_kernel_base.value()) { | ||||
|  | @ -610,7 +610,7 @@ ProfileNode::ProfileNode(Process const& process) | |||
| { | ||||
| } | ||||
| 
 | ||||
| ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) | ||||
| ProfileNode::ProfileNode(Process const& process, DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) | ||||
|     : m_process(process) | ||||
|     , m_symbol(move(symbol)) | ||||
|     , m_pid(pid) | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
| #include "SignpostsModel.h" | ||||
| #include "SourceModel.h" | ||||
| #include <AK/Bitmap.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/JsonArray.h> | ||||
| #include <AK/JsonObject.h> | ||||
| #include <AK/JsonValue.h> | ||||
|  | @ -34,7 +34,7 @@ extern OwnPtr<Debug::DebugInfo> g_kernel_debug_info; | |||
| 
 | ||||
| class ProfileNode : public RefCounted<ProfileNode> { | ||||
| public: | ||||
|     static NonnullRefPtr<ProfileNode> create(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) | ||||
|     static NonnullRefPtr<ProfileNode> create(Process const& process, DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) | ||||
|     { | ||||
|         return adopt_ref(*new ProfileNode(process, object_name, move(symbol), address, offset, timestamp, pid)); | ||||
|     } | ||||
|  | @ -53,7 +53,7 @@ public: | |||
|     bool has_seen_event(size_t event_index) const { return m_seen_events.get(event_index); } | ||||
|     void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); } | ||||
| 
 | ||||
|     FlyString const& object_name() const { return m_object_name; } | ||||
|     DeprecatedFlyString const& object_name() const { return m_object_name; } | ||||
|     DeprecatedString const& symbol() const { return m_symbol; } | ||||
|     FlatPtr address() const { return m_address; } | ||||
|     u32 offset() const { return m_offset; } | ||||
|  | @ -74,7 +74,7 @@ public: | |||
|         m_children.append(child); | ||||
|     } | ||||
| 
 | ||||
|     ProfileNode& find_or_create_child(FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) | ||||
|     ProfileNode& find_or_create_child(DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) | ||||
|     { | ||||
|         for (size_t i = 0; i < m_children.size(); ++i) { | ||||
|             auto& child = m_children[i]; | ||||
|  | @ -112,12 +112,12 @@ public: | |||
| 
 | ||||
| private: | ||||
|     explicit ProfileNode(Process const&); | ||||
|     explicit ProfileNode(Process const&, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); | ||||
|     explicit ProfileNode(Process const&, DeprecatedFlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); | ||||
| 
 | ||||
|     bool m_root { false }; | ||||
|     Process const& m_process; | ||||
|     ProfileNode* m_parent { nullptr }; | ||||
|     FlyString m_object_name; | ||||
|     DeprecatedFlyString m_object_name; | ||||
|     DeprecatedString m_symbol; | ||||
|     pid_t m_pid { 0 }; | ||||
|     FlatPtr m_address { 0 }; | ||||
|  | @ -166,7 +166,7 @@ public: | |||
|     Vector<NonnullRefPtr<ProfileNode>> const& roots() const { return m_roots; } | ||||
| 
 | ||||
|     struct Frame { | ||||
|         FlyString object_name; | ||||
|         DeprecatedFlyString object_name; | ||||
|         DeprecatedString symbol; | ||||
|         FlatPtr address { 0 }; | ||||
|         u32 offset { 0 }; | ||||
|  |  | |||
|  | @ -5,9 +5,9 @@ | |||
|  */ | ||||
| 
 | ||||
| #include <AK/Debug.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FixedArray.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/Format.h> | ||||
| #include <AK/IntegralMath.h> | ||||
| #include <AK/Math.h> | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Error.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <errno.h> | ||||
| 
 | ||||
| namespace Audio { | ||||
|  | @ -28,20 +28,20 @@ struct LoaderError { | |||
|     Category category { Category::Unknown }; | ||||
|     // Binary index: where in the file the error occurred.
 | ||||
|     size_t index { 0 }; | ||||
|     FlyString description { DeprecatedString::empty() }; | ||||
|     DeprecatedFlyString description { DeprecatedString::empty() }; | ||||
| 
 | ||||
|     constexpr LoaderError() = default; | ||||
|     LoaderError(Category category, size_t index, FlyString description) | ||||
|     LoaderError(Category category, size_t index, DeprecatedFlyString description) | ||||
|         : category(category) | ||||
|         , index(index) | ||||
|         , description(move(description)) | ||||
|     { | ||||
|     } | ||||
|     LoaderError(FlyString description) | ||||
|     LoaderError(DeprecatedFlyString description) | ||||
|         : description(move(description)) | ||||
|     { | ||||
|     } | ||||
|     LoaderError(Category category, FlyString description) | ||||
|     LoaderError(Category category, DeprecatedFlyString description) | ||||
|         : category(category) | ||||
|         , description(move(description)) | ||||
|     { | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/NonnullRefPtrVector.h> | ||||
| #include <AK/Optional.h> | ||||
| #include <AK/RefCounted.h> | ||||
|  | @ -47,7 +47,7 @@ public: | |||
|         VERIFY(m_end.has_value()); | ||||
|         return m_end.value(); | ||||
|     } | ||||
|     FlyString const& filename() const | ||||
|     DeprecatedFlyString const& filename() const | ||||
|     { | ||||
|         return m_filename; | ||||
|     } | ||||
|  | @ -78,7 +78,7 @@ private: | |||
|     ASTNode* m_parent { nullptr }; | ||||
|     Optional<Position> m_start; | ||||
|     Optional<Position> m_end; | ||||
|     FlyString m_filename; | ||||
|     DeprecatedFlyString m_filename; | ||||
| }; | ||||
| 
 | ||||
| class TranslationUnit : public ASTNode { | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/Function.h> | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/Optional.h> | ||||
|  | @ -28,7 +28,7 @@ public: | |||
|         DeprecatedString key; | ||||
|         Vector<DeprecatedString> parameters; | ||||
|         DeprecatedString value; | ||||
|         FlyString filename; | ||||
|         DeprecatedFlyString filename; | ||||
|         size_t line { 0 }; | ||||
|         size_t column { 0 }; | ||||
|     }; | ||||
|  |  | |||
|  | @ -86,8 +86,8 @@ void DebugInfo::prepare_lines() | |||
|         all_lines.extend(unit.line_program().lines()); | ||||
|     }); | ||||
| 
 | ||||
|     HashMap<FlyString, Optional<DeprecatedString>> memoized_full_paths; | ||||
|     auto compute_full_path = [&](FlyString const& file_path) -> Optional<DeprecatedString> { | ||||
|     HashMap<DeprecatedFlyString, Optional<DeprecatedString>> memoized_full_paths; | ||||
|     auto compute_full_path = [&](DeprecatedFlyString const& file_path) -> Optional<DeprecatedString> { | ||||
|         if (file_path.view().contains("Toolchain/"sv) || file_path.view().contains("libgcc"sv)) | ||||
|             return {}; | ||||
|         if (file_path.view().starts_with("./"sv) && !m_source_root.is_null()) | ||||
|  |  | |||
|  | @ -29,7 +29,7 @@ public: | |||
|     ELF::Image const& elf() const { return m_elf; } | ||||
| 
 | ||||
|     struct SourcePosition { | ||||
|         FlyString file_path; | ||||
|         DeprecatedFlyString file_path; | ||||
|         size_t line_number { 0 }; | ||||
|         Optional<FlatPtr> address_of_first_statement; | ||||
| 
 | ||||
|  |  | |||
|  | @ -138,7 +138,7 @@ void LineProgram::append_to_line_info() | |||
|     full_path.append('/'); | ||||
|     full_path.append(m_source_files[m_file_index].name); | ||||
| 
 | ||||
|     m_lines.append({ m_address, FlyString { full_path.string_view() }, m_line }); | ||||
|     m_lines.append({ m_address, DeprecatedFlyString { full_path.string_view() }, m_line }); | ||||
| } | ||||
| 
 | ||||
| void LineProgram::reset_registers() | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/MemoryStream.h> | ||||
| #include <AK/Vector.h> | ||||
| #include <LibDebug/Dwarf/DwarfTypes.h> | ||||
|  | @ -112,20 +112,20 @@ public: | |||
| 
 | ||||
|     struct LineInfo { | ||||
|         FlatPtr address { 0 }; | ||||
|         FlyString file; | ||||
|         DeprecatedFlyString file; | ||||
|         size_t line { 0 }; | ||||
|     }; | ||||
| 
 | ||||
|     Vector<LineInfo> const& lines() const { return m_lines; } | ||||
| 
 | ||||
|     struct DirectoryAndFile { | ||||
|         FlyString directory; | ||||
|         FlyString filename; | ||||
|         DeprecatedFlyString directory; | ||||
|         DeprecatedFlyString filename; | ||||
|     }; | ||||
|     DirectoryAndFile get_directory_and_file(size_t file_index) const; | ||||
| 
 | ||||
|     struct FileEntry { | ||||
|         FlyString name; | ||||
|         DeprecatedFlyString name; | ||||
|         size_t directory_index { 0 }; | ||||
|     }; | ||||
|     Vector<FileEntry> const& source_files() const { return m_source_files; } | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/NonnullRefPtrVector.h> | ||||
| #include <AK/Queue.h> | ||||
| #include <AK/QuickSort.h> | ||||
|  | @ -118,7 +118,7 @@ Font& FontDatabase::default_fixed_width_font() | |||
| 
 | ||||
| struct FontDatabase::Private { | ||||
|     HashMap<DeprecatedString, NonnullRefPtr<Gfx::Font>> full_name_to_font_map; | ||||
|     HashMap<FlyString, Vector<NonnullRefPtr<Typeface>>> typefaces; | ||||
|     HashMap<DeprecatedFlyString, Vector<NonnullRefPtr<Typeface>>> typefaces; | ||||
| }; | ||||
| 
 | ||||
| void FontDatabase::load_all_fonts_from_path(DeprecatedString const& root) | ||||
|  | @ -214,7 +214,7 @@ RefPtr<Gfx::Font> FontDatabase::get_by_name(StringView name) | |||
|     return it->value; | ||||
| } | ||||
| 
 | ||||
| RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match) | ||||
| RefPtr<Gfx::Font> FontDatabase::get(DeprecatedFlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch allow_inexact_size_match) | ||||
| { | ||||
|     auto it = m_private->typefaces.find(family); | ||||
|     if (it == m_private->typefaces.end()) | ||||
|  | @ -226,7 +226,7 @@ RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, float point_size, u | |||
|     return nullptr; | ||||
| } | ||||
| 
 | ||||
| RefPtr<Gfx::Font> FontDatabase::get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch allow_inexact_size_match) | ||||
| RefPtr<Gfx::Font> FontDatabase::get(DeprecatedFlyString const& family, DeprecatedFlyString const& variant, float point_size, Font::AllowInexactSizeMatch allow_inexact_size_match) | ||||
| { | ||||
|     auto it = m_private->typefaces.find(family); | ||||
|     if (it == m_private->typefaces.end()) | ||||
|  |  | |||
|  | @ -48,8 +48,8 @@ public: | |||
|     static void set_fixed_width_font_query(DeprecatedString); | ||||
|     static void set_default_fonts_lookup_path(DeprecatedString); | ||||
| 
 | ||||
|     RefPtr<Gfx::Font> get(FlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No); | ||||
|     RefPtr<Gfx::Font> get(FlyString const& family, FlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No); | ||||
|     RefPtr<Gfx::Font> get(DeprecatedFlyString const& family, float point_size, unsigned weight, unsigned slope, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No); | ||||
|     RefPtr<Gfx::Font> get(DeprecatedFlyString const& family, DeprecatedFlyString const& variant, float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No); | ||||
|     RefPtr<Gfx::Font> get_by_name(StringView); | ||||
|     void for_each_font(Function<void(Gfx::Font const&)>); | ||||
|     void for_each_fixed_width_font(Function<void(Gfx::Font const&)>); | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Function.h> | ||||
| #include <AK/RefCounted.h> | ||||
| #include <AK/Vector.h> | ||||
|  | @ -24,8 +24,8 @@ public: | |||
|     { | ||||
|     } | ||||
| 
 | ||||
|     FlyString const& family() const { return m_family; } | ||||
|     FlyString const& variant() const { return m_variant; } | ||||
|     DeprecatedFlyString const& family() const { return m_family; } | ||||
|     DeprecatedFlyString const& variant() const { return m_variant; } | ||||
|     unsigned weight() const; | ||||
|     u8 slope() const; | ||||
| 
 | ||||
|  | @ -39,8 +39,8 @@ public: | |||
|     RefPtr<Font> get_font(float point_size, Font::AllowInexactSizeMatch = Font::AllowInexactSizeMatch::No) const; | ||||
| 
 | ||||
| private: | ||||
|     FlyString m_family; | ||||
|     FlyString m_variant; | ||||
|     DeprecatedFlyString m_family; | ||||
|     DeprecatedFlyString m_variant; | ||||
| 
 | ||||
|     Vector<RefPtr<BitmapFont>> m_bitmap_fonts; | ||||
|     RefPtr<VectorFont> m_vector_font; | ||||
|  |  | |||
|  | @ -85,7 +85,7 @@ static void print_indent(int indent) | |||
|     out("{}", DeprecatedString::repeated(' ', indent * 2)); | ||||
| } | ||||
| 
 | ||||
| static void update_function_name(Value value, FlyString const& name) | ||||
| static void update_function_name(Value value, DeprecatedFlyString const& name) | ||||
| { | ||||
|     if (!value.is_function()) | ||||
|         return; | ||||
|  | @ -116,7 +116,7 @@ Completion ScopeNode::evaluate_statements(Interpreter& interpreter) const | |||
| 
 | ||||
| // 14.13.4 Runtime Semantics: LabelledEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-labelledevaluation
 | ||||
| // BreakableStatement : IterationStatement
 | ||||
| static Completion labelled_evaluation(Interpreter& interpreter, IterationStatement const& statement, Vector<FlyString> const& label_set) | ||||
| static Completion labelled_evaluation(Interpreter& interpreter, IterationStatement const& statement, Vector<DeprecatedFlyString> const& label_set) | ||||
| { | ||||
|     // 1. Let stmtResult be Completion(LoopEvaluation of IterationStatement with argument labelSet).
 | ||||
|     auto result = statement.loop_evaluation(interpreter, label_set); | ||||
|  | @ -137,7 +137,7 @@ static Completion labelled_evaluation(Interpreter& interpreter, IterationStateme | |||
| 
 | ||||
| // 14.13.4 Runtime Semantics: LabelledEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-labelledevaluation
 | ||||
| // BreakableStatement : SwitchStatement
 | ||||
| static Completion labelled_evaluation(Interpreter& interpreter, SwitchStatement const& statement, Vector<FlyString> const&) | ||||
| static Completion labelled_evaluation(Interpreter& interpreter, SwitchStatement const& statement, Vector<DeprecatedFlyString> const&) | ||||
| { | ||||
|     // 1. Let stmtResult be the result of evaluating SwitchStatement.
 | ||||
|     auto result = statement.execute_impl(interpreter); | ||||
|  | @ -158,7 +158,7 @@ static Completion labelled_evaluation(Interpreter& interpreter, SwitchStatement | |||
| 
 | ||||
| // 14.13.4 Runtime Semantics: LabelledEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-labelledevaluation
 | ||||
| // LabelledStatement : LabelIdentifier : LabelledItem
 | ||||
| static Completion labelled_evaluation(Interpreter& interpreter, LabelledStatement const& statement, Vector<FlyString> const& label_set) | ||||
| static Completion labelled_evaluation(Interpreter& interpreter, LabelledStatement const& statement, Vector<DeprecatedFlyString> const& label_set) | ||||
| { | ||||
|     auto const& labelled_item = *statement.labelled_item(); | ||||
| 
 | ||||
|  | @ -167,7 +167,7 @@ static Completion labelled_evaluation(Interpreter& interpreter, LabelledStatemen | |||
| 
 | ||||
|     // 2. Let newLabelSet be the list-concatenation of labelSet and « label ».
 | ||||
|     // Optimization: Avoid vector copy if possible.
 | ||||
|     Optional<Vector<FlyString>> new_label_set; | ||||
|     Optional<Vector<DeprecatedFlyString>> new_label_set; | ||||
|     if (is<IterationStatement>(labelled_item) || is<SwitchStatement>(labelled_item) || is<LabelledStatement>(labelled_item)) { | ||||
|         new_label_set = label_set; | ||||
|         new_label_set->append(label); | ||||
|  | @ -298,7 +298,7 @@ Completion FunctionExpression::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 15.2.5 Runtime Semantics: InstantiateOrdinaryFunctionExpression, https://tc39.es/ecma262/#sec-runtime-semantics-instantiateordinaryfunctionexpression
 | ||||
| Value FunctionExpression::instantiate_ordinary_function_expression(Interpreter& interpreter, FlyString given_name) const | ||||
| Value FunctionExpression::instantiate_ordinary_function_expression(Interpreter& interpreter, DeprecatedFlyString given_name) const | ||||
| { | ||||
|     auto& vm = interpreter.vm(); | ||||
|     auto& realm = *vm.current_realm(); | ||||
|  | @ -637,7 +637,7 @@ Completion WithStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.1.1 LoopContinues ( completion, labelSet ), https://tc39.es/ecma262/#sec-loopcontinues
 | ||||
| static bool loop_continues(Completion const& completion, Vector<FlyString> const& label_set) | ||||
| static bool loop_continues(Completion const& completion, Vector<DeprecatedFlyString> const& label_set) | ||||
| { | ||||
|     // 1. If completion.[[Type]] is normal, return true.
 | ||||
|     if (completion.type() == Completion::Type::Normal) | ||||
|  | @ -669,7 +669,7 @@ Completion WhileStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.3.2 Runtime Semantics: WhileLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-whileloopevaluation
 | ||||
| Completion WhileStatement::loop_evaluation(Interpreter& interpreter, Vector<FlyString> const& label_set) const | ||||
| Completion WhileStatement::loop_evaluation(Interpreter& interpreter, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     InterpreterNodeScope node_scope { interpreter, *this }; | ||||
| 
 | ||||
|  | @ -711,7 +711,7 @@ Completion DoWhileStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.2.2 Runtime Semantics: DoWhileLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-dowhileloopevaluation
 | ||||
| Completion DoWhileStatement::loop_evaluation(Interpreter& interpreter, Vector<FlyString> const& label_set) const | ||||
| Completion DoWhileStatement::loop_evaluation(Interpreter& interpreter, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     InterpreterNodeScope node_scope { interpreter, *this }; | ||||
| 
 | ||||
|  | @ -753,7 +753,7 @@ Completion ForStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.4.2 Runtime Semantics: ForLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-forloopevaluation
 | ||||
| Completion ForStatement::loop_evaluation(Interpreter& interpreter, Vector<FlyString> const& label_set) const | ||||
| Completion ForStatement::loop_evaluation(Interpreter& interpreter, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     InterpreterNodeScope node_scope { interpreter, *this }; | ||||
|     auto& vm = interpreter.vm(); | ||||
|  | @ -1055,7 +1055,7 @@ Completion ForInStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.5.5 Runtime Semantics: ForInOfLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-forinofloopevaluation
 | ||||
| Completion ForInStatement::loop_evaluation(Interpreter& interpreter, Vector<FlyString> const& label_set) const | ||||
| Completion ForInStatement::loop_evaluation(Interpreter& interpreter, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     InterpreterNodeScope node_scope { interpreter, *this }; | ||||
|     auto& vm = interpreter.vm(); | ||||
|  | @ -1121,7 +1121,7 @@ Completion ForOfStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.5.5 Runtime Semantics: ForInOfLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-forinofloopevaluation
 | ||||
| Completion ForOfStatement::loop_evaluation(Interpreter& interpreter, Vector<FlyString> const& label_set) const | ||||
| Completion ForOfStatement::loop_evaluation(Interpreter& interpreter, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     InterpreterNodeScope node_scope { interpreter, *this }; | ||||
|     auto& vm = interpreter.vm(); | ||||
|  | @ -1185,7 +1185,7 @@ Completion ForAwaitOfStatement::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 14.7.5.5 Runtime Semantics: ForInOfLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-forinofloopevaluation
 | ||||
| Completion ForAwaitOfStatement::loop_evaluation(Interpreter& interpreter, Vector<FlyString> const& label_set) const | ||||
| Completion ForAwaitOfStatement::loop_evaluation(Interpreter& interpreter, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     InterpreterNodeScope node_scope { interpreter, *this }; | ||||
|     auto& vm = interpreter.vm(); | ||||
|  | @ -1653,7 +1653,7 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassMethod::class_element_evaluatio | |||
| // 10.2.1.3 Runtime Semantics: EvaluateBody, https://tc39.es/ecma262/#sec-runtime-semantics-evaluatebody
 | ||||
| class ClassFieldInitializerStatement : public Statement { | ||||
| public: | ||||
|     ClassFieldInitializerStatement(SourceRange source_range, NonnullRefPtr<Expression> expression, FlyString field_name) | ||||
|     ClassFieldInitializerStatement(SourceRange source_range, NonnullRefPtr<Expression> expression, DeprecatedFlyString field_name) | ||||
|         : Statement(source_range) | ||||
|         , m_expression(move(expression)) | ||||
|         , m_class_field_identifier_name(move(field_name)) | ||||
|  | @ -1687,7 +1687,7 @@ public: | |||
| 
 | ||||
| private: | ||||
|     NonnullRefPtr<Expression> m_expression; | ||||
|     FlyString m_class_field_identifier_name; // [[ClassFieldIdentifierName]]
 | ||||
|     DeprecatedFlyString m_class_field_identifier_name; // [[ClassFieldIdentifierName]]
 | ||||
| }; | ||||
| 
 | ||||
| // 15.7.10 Runtime Semantics: ClassFieldDefinitionEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-classfielddefinitionevaluation
 | ||||
|  | @ -1722,19 +1722,19 @@ ThrowCompletionOr<ClassElement::ClassValue> ClassField::class_element_evaluation | |||
|     }; | ||||
| } | ||||
| 
 | ||||
| static Optional<FlyString> nullopt_or_private_identifier_description(Expression const& expression) | ||||
| static Optional<DeprecatedFlyString> nullopt_or_private_identifier_description(Expression const& expression) | ||||
| { | ||||
|     if (is<PrivateIdentifier>(expression)) | ||||
|         return static_cast<PrivateIdentifier const&>(expression).string(); | ||||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| Optional<FlyString> ClassField::private_bound_identifier() const | ||||
| Optional<DeprecatedFlyString> ClassField::private_bound_identifier() const | ||||
| { | ||||
|     return nullopt_or_private_identifier_description(*m_key); | ||||
| } | ||||
| 
 | ||||
| Optional<FlyString> ClassMethod::private_bound_identifier() const | ||||
| Optional<DeprecatedFlyString> ClassMethod::private_bound_identifier() const | ||||
| { | ||||
|     return nullopt_or_private_identifier_description(*m_key); | ||||
| } | ||||
|  | @ -1834,7 +1834,7 @@ Completion ClassDeclaration::execute(Interpreter& interpreter) const | |||
| } | ||||
| 
 | ||||
| // 15.7.14 Runtime Semantics: ClassDefinitionEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-classdefinitionevaluation
 | ||||
| ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_evaluation(Interpreter& interpreter, FlyString const& binding_name, FlyString const& class_name) const | ||||
| ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_evaluation(Interpreter& interpreter, DeprecatedFlyString const& binding_name, DeprecatedFlyString const& class_name) const | ||||
| { | ||||
|     auto& vm = interpreter.vm(); | ||||
|     auto& realm = *vm.current_realm(); | ||||
|  | @ -2201,7 +2201,7 @@ void ClassDeclaration::dump(int indent) const | |||
|     m_class_expression->dump(indent + 1); | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ClassDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const | ||||
| ThrowCompletionOr<void> ClassDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const | ||||
| { | ||||
|     if (m_class_expression->name().is_empty()) | ||||
|         return {}; | ||||
|  | @ -2331,7 +2331,7 @@ bool BindingPattern::contains_expression() const | |||
|     return false; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> BindingPattern::for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const | ||||
| ThrowCompletionOr<void> BindingPattern::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const | ||||
| { | ||||
|     for (auto const& entry : entries) { | ||||
|         auto const& alias = entry.alias; | ||||
|  | @ -2411,7 +2411,7 @@ void FunctionNode::dump(int indent, DeprecatedString const& class_name) const | |||
|             if (parameter.is_rest) | ||||
|                 out("..."); | ||||
|             parameter.binding.visit( | ||||
|                 [&](FlyString const& name) { | ||||
|                 [&](DeprecatedFlyString const& name) { | ||||
|                     outln("{}", name); | ||||
|                 }, | ||||
|                 [&](BindingPattern const& pattern) { | ||||
|  | @ -2431,7 +2431,7 @@ void FunctionDeclaration::dump(int indent) const | |||
|     FunctionNode::dump(indent, class_name()); | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const | ||||
| ThrowCompletionOr<void> FunctionDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const | ||||
| { | ||||
|     if (name().is_empty()) | ||||
|         return {}; | ||||
|  | @ -2975,7 +2975,7 @@ Completion VariableDeclarator::execute(Interpreter& interpreter) const | |||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> VariableDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const | ||||
| ThrowCompletionOr<void> VariableDeclaration::for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const | ||||
| { | ||||
|     for (auto const& entry : declarations()) { | ||||
|         TRY(entry.target().visit( | ||||
|  | @ -3808,7 +3808,7 @@ void CatchClause::dump(int indent) const | |||
| { | ||||
|     print_indent(indent); | ||||
|     m_parameter.visit( | ||||
|         [&](FlyString const& parameter) { | ||||
|         [&](DeprecatedFlyString const& parameter) { | ||||
|             if (parameter.is_null()) | ||||
|                 outln("CatchClause"); | ||||
|             else | ||||
|  | @ -3845,7 +3845,7 @@ Completion TryStatement::execute(Interpreter& interpreter) const | |||
|         auto catch_environment = new_declarative_environment(*old_environment); | ||||
| 
 | ||||
|         m_handler->parameter().visit( | ||||
|             [&](FlyString const& parameter) { | ||||
|             [&](DeprecatedFlyString const& parameter) { | ||||
|                 // 3. For each element argName of the BoundNames of CatchParameter, do
 | ||||
|                 // a. Perform ! catchEnv.CreateMutableBinding(argName, false).
 | ||||
|                 MUST(catch_environment->create_mutable_binding(vm, parameter, false)); | ||||
|  | @ -3863,7 +3863,7 @@ Completion TryStatement::execute(Interpreter& interpreter) const | |||
| 
 | ||||
|         // 5. Let status be Completion(BindingInitialization of CatchParameter with arguments thrownValue and catchEnv).
 | ||||
|         auto status = m_handler->parameter().visit( | ||||
|             [&](FlyString const& parameter) { | ||||
|             [&](DeprecatedFlyString const& parameter) { | ||||
|                 return catch_environment->initialize_binding(vm, parameter, thrown_value); | ||||
|             }, | ||||
|             [&](NonnullRefPtr<BindingPattern> const& pattern) { | ||||
|  | @ -4333,7 +4333,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_lexically_scoped_declaration(ThrowCo | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ScopeNode::for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const | ||||
| ThrowCompletionOr<void> ScopeNode::for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const | ||||
| { | ||||
|     for (auto const& declaration : m_lexical_declarations) { | ||||
|         TRY(declaration.for_each_bound_name([&](auto const& name) { | ||||
|  | @ -4343,7 +4343,7 @@ ThrowCompletionOr<void> ScopeNode::for_each_lexically_declared_name(ThrowComplet | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> ScopeNode::for_each_var_declared_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const | ||||
| ThrowCompletionOr<void> ScopeNode::for_each_var_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const | ||||
| { | ||||
|     for (auto& declaration : m_var_declarations) { | ||||
|         TRY(declaration.for_each_bound_name([&](auto const& name) { | ||||
|  | @ -4407,7 +4407,7 @@ Completion ImportStatement::execute(Interpreter& interpreter) const | |||
|     return Optional<Value> {}; | ||||
| } | ||||
| 
 | ||||
| FlyString ExportStatement::local_name_for_default = "*default*"; | ||||
| DeprecatedFlyString ExportStatement::local_name_for_default = "*default*"; | ||||
| 
 | ||||
| // 16.2.3.7 Runtime Semantics: Evaluation, https://tc39.es/ecma262/#sec-exports-runtime-semantics-evaluation
 | ||||
| Completion ExportStatement::execute(Interpreter& interpreter) const | ||||
|  | @ -4557,7 +4557,7 @@ void ImportStatement::dump(int indent) const | |||
|     } | ||||
| } | ||||
| 
 | ||||
| bool ExportStatement::has_export(FlyString const& export_name) const | ||||
| bool ExportStatement::has_export(DeprecatedFlyString const& export_name) const | ||||
| { | ||||
|     return any_of(m_entries.begin(), m_entries.end(), [&](auto& entry) { | ||||
|         // Make sure that empty exported names does not overlap with anything
 | ||||
|  | @ -4567,7 +4567,7 @@ bool ExportStatement::has_export(FlyString const& export_name) const | |||
|     }); | ||||
| } | ||||
| 
 | ||||
| bool ImportStatement::has_bound_name(FlyString const& name) const | ||||
| bool ImportStatement::has_bound_name(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     return any_of(m_entries.begin(), m_entries.end(), [&](auto& entry) { | ||||
|         return entry.local_name == name; | ||||
|  | @ -4613,7 +4613,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i | |||
|     // 1. Let lexNames be the LexicallyDeclaredNames of script.
 | ||||
|     // 2. Let varNames be the VarDeclaredNames of script.
 | ||||
|     // 3. For each element name of lexNames, do
 | ||||
|     TRY(for_each_lexically_declared_name([&](FlyString const& name) -> ThrowCompletionOr<void> { | ||||
|     TRY(for_each_lexically_declared_name([&](DeprecatedFlyString const& name) -> ThrowCompletionOr<void> { | ||||
|         // a. If env.HasVarDeclaration(name) is true, throw a SyntaxError exception.
 | ||||
|         if (global_environment.has_var_declaration(name)) | ||||
|             return vm.throw_completion<SyntaxError>(ErrorType::TopLevelVariableAlreadyDeclared, name); | ||||
|  | @ -4646,7 +4646,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i | |||
|     Vector<FunctionDeclaration const&> functions_to_initialize; | ||||
| 
 | ||||
|     // 7. Let declaredFunctionNames be a new empty List.
 | ||||
|     HashTable<FlyString> declared_function_names; | ||||
|     HashTable<DeprecatedFlyString> declared_function_names; | ||||
| 
 | ||||
|     // 8. For each element d of varDeclarations, in reverse List order, do
 | ||||
| 
 | ||||
|  | @ -4681,7 +4681,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i | |||
|     })); | ||||
| 
 | ||||
|     // 9. Let declaredVarNames be a new empty List.
 | ||||
|     HashTable<FlyString> declared_var_names; | ||||
|     HashTable<DeprecatedFlyString> declared_var_names; | ||||
| 
 | ||||
|     // 10. For each element d of varDeclarations, do
 | ||||
|     TRY(for_each_var_scoped_variable_declaration([&](Declaration const& declaration) { | ||||
|  | @ -4808,7 +4808,7 @@ ThrowCompletionOr<void> Program::global_declaration_instantiation(Interpreter& i | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ModuleRequest::ModuleRequest(FlyString module_specifier_, Vector<Assertion> assertions_) | ||||
| ModuleRequest::ModuleRequest(DeprecatedFlyString module_specifier_, Vector<Assertion> assertions_) | ||||
|     : module_specifier(move(module_specifier_)) | ||||
|     , assertions(move(assertions_)) | ||||
| { | ||||
|  |  | |||
|  | @ -8,8 +8,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/NonnullRefPtrVector.h> | ||||
| #include <AK/OwnPtr.h> | ||||
|  | @ -152,7 +152,7 @@ public: | |||
| // 14.13 Labelled Statements, https://tc39.es/ecma262/#sec-labelled-statements
 | ||||
| class LabelledStatement : public Statement { | ||||
| public: | ||||
|     LabelledStatement(SourceRange source_range, FlyString label, NonnullRefPtr<Statement> labelled_item) | ||||
|     LabelledStatement(SourceRange source_range, DeprecatedFlyString label, NonnullRefPtr<Statement> labelled_item) | ||||
|         : Statement(source_range) | ||||
|         , m_label(move(label)) | ||||
|         , m_labelled_item(move(labelled_item)) | ||||
|  | @ -162,17 +162,17 @@ public: | |||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const; | ||||
| 
 | ||||
|     FlyString const& label() const { return m_label; } | ||||
|     FlyString& label() { return m_label; } | ||||
|     DeprecatedFlyString const& label() const { return m_label; } | ||||
|     DeprecatedFlyString& label() { return m_label; } | ||||
|     NonnullRefPtr<Statement> const& labelled_item() const { return m_labelled_item; } | ||||
|     NonnullRefPtr<Statement>& labelled_item() { return m_labelled_item; } | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_labelled_statement() const final { return true; } | ||||
| 
 | ||||
|     FlyString m_label; | ||||
|     DeprecatedFlyString m_label; | ||||
|     NonnullRefPtr<Statement> m_labelled_item; | ||||
| }; | ||||
| 
 | ||||
|  | @ -180,19 +180,19 @@ class LabelableStatement : public Statement { | |||
| public: | ||||
|     using Statement::Statement; | ||||
| 
 | ||||
|     Vector<FlyString> const& labels() const { return m_labels; } | ||||
|     virtual void add_label(FlyString string) { m_labels.append(move(string)); } | ||||
|     Vector<DeprecatedFlyString> const& labels() const { return m_labels; } | ||||
|     virtual void add_label(DeprecatedFlyString string) { m_labels.append(move(string)); } | ||||
| 
 | ||||
| protected: | ||||
|     Vector<FlyString> m_labels; | ||||
|     Vector<DeprecatedFlyString> m_labels; | ||||
| }; | ||||
| 
 | ||||
| class IterationStatement : public Statement { | ||||
| public: | ||||
|     using Statement::Statement; | ||||
| 
 | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const = 0; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const = 0; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const; | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_iteration_statement() const final { return true; } | ||||
|  | @ -305,9 +305,9 @@ public: | |||
|     [[nodiscard]] size_t lexical_declaration_count() const { return m_lexical_declarations.size(); } | ||||
| 
 | ||||
|     ThrowCompletionOr<void> for_each_lexically_scoped_declaration(ThrowCompletionOrVoidCallback<Declaration const&>&& callback) const; | ||||
|     ThrowCompletionOr<void> for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const; | ||||
|     ThrowCompletionOr<void> for_each_lexically_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const; | ||||
| 
 | ||||
|     ThrowCompletionOr<void> for_each_var_declared_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const; | ||||
|     ThrowCompletionOr<void> for_each_var_declared_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const; | ||||
| 
 | ||||
|     ThrowCompletionOr<void> for_each_var_function_declaration_in_reverse_order(ThrowCompletionOrVoidCallback<FunctionDeclaration const&>&& callback) const; | ||||
|     ThrowCompletionOr<void> for_each_var_scoped_variable_declaration(ThrowCompletionOrVoidCallback<VariableDeclaration const&>&& callback) const; | ||||
|  | @ -334,11 +334,11 @@ private: | |||
| 
 | ||||
| // ImportEntry Record, https://tc39.es/ecma262/#table-importentry-record-fields
 | ||||
| struct ImportEntry { | ||||
|     FlyString import_name;       // [[ImportName]] if a String
 | ||||
|     FlyString local_name;        // [[LocalName]]
 | ||||
|     DeprecatedFlyString import_name; // [[ImportName]] if a String
 | ||||
|     DeprecatedFlyString local_name;  // [[LocalName]]
 | ||||
|     bool is_namespace { false };     // [[ImportName]] if `namespace-object`
 | ||||
| 
 | ||||
|     ImportEntry(FlyString import_name_, FlyString local_name_, bool is_namespace_ = false) | ||||
|     ImportEntry(DeprecatedFlyString import_name_, DeprecatedFlyString local_name_, bool is_namespace_ = false) | ||||
|         : import_name(move(import_name_)) | ||||
|         , local_name(move(local_name_)) | ||||
|         , is_namespace(is_namespace_) | ||||
|  | @ -372,7 +372,7 @@ public: | |||
| 
 | ||||
|     virtual void dump(int indent) const override; | ||||
| 
 | ||||
|     bool has_bound_name(FlyString const& name) const; | ||||
|     bool has_bound_name(DeprecatedFlyString const& name) const; | ||||
|     Vector<ImportEntry> const& entries() const { return m_entries; } | ||||
|     ModuleRequest const& module_request() const { return m_module_request; } | ||||
|     ModuleRequest& module_request() { return m_module_request; } | ||||
|  | @ -395,10 +395,10 @@ struct ExportEntry { | |||
|         EmptyNamedExport, | ||||
|     } kind; | ||||
| 
 | ||||
|     FlyString export_name;          // [[ExportName]]
 | ||||
|     FlyString local_or_import_name; // Either [[ImportName]] or [[LocalName]]
 | ||||
|     DeprecatedFlyString export_name;          // [[ExportName]]
 | ||||
|     DeprecatedFlyString local_or_import_name; // Either [[ImportName]] or [[LocalName]]
 | ||||
| 
 | ||||
|     ExportEntry(Kind export_kind, FlyString export_name_, FlyString local_or_import_name_) | ||||
|     ExportEntry(Kind export_kind, DeprecatedFlyString export_name_, DeprecatedFlyString local_or_import_name_) | ||||
|         : kind(export_kind) | ||||
|         , export_name(move(export_name_)) | ||||
|         , local_or_import_name(move(local_or_import_name_)) | ||||
|  | @ -410,7 +410,7 @@ struct ExportEntry { | |||
|         return m_module_request != nullptr; | ||||
|     } | ||||
| 
 | ||||
|     static ExportEntry indirect_export_entry(ModuleRequest const& module_request, FlyString export_name, FlyString import_name) | ||||
|     static ExportEntry indirect_export_entry(ModuleRequest const& module_request, DeprecatedFlyString export_name, DeprecatedFlyString import_name) | ||||
|     { | ||||
|         ExportEntry entry { Kind::NamedExport, move(export_name), move(import_name) }; | ||||
|         entry.m_module_request = &module_request; | ||||
|  | @ -428,7 +428,7 @@ private: | |||
|     friend class ExportStatement; | ||||
| 
 | ||||
| public: | ||||
|     static ExportEntry named_export(FlyString export_name, FlyString local_name) | ||||
|     static ExportEntry named_export(DeprecatedFlyString export_name, DeprecatedFlyString local_name) | ||||
|     { | ||||
|         return ExportEntry { Kind::NamedExport, move(export_name), move(local_name) }; | ||||
|     } | ||||
|  | @ -438,7 +438,7 @@ public: | |||
|         return ExportEntry { Kind::ModuleRequestAllButDefault, {}, {} }; | ||||
|     } | ||||
| 
 | ||||
|     static ExportEntry all_module_request(FlyString export_name) | ||||
|     static ExportEntry all_module_request(DeprecatedFlyString export_name) | ||||
|     { | ||||
|         return ExportEntry { Kind::ModuleRequestAll, move(export_name), {} }; | ||||
|     } | ||||
|  | @ -451,7 +451,7 @@ public: | |||
| 
 | ||||
| class ExportStatement final : public Statement { | ||||
| public: | ||||
|     static FlyString local_name_for_default; | ||||
|     static DeprecatedFlyString local_name_for_default; | ||||
| 
 | ||||
|     ExportStatement(SourceRange source_range, RefPtr<ASTNode> statement, Vector<ExportEntry> entries, bool is_default_export, ModuleRequest module_request) | ||||
|         : Statement(source_range) | ||||
|  | @ -470,7 +470,7 @@ public: | |||
| 
 | ||||
|     virtual void dump(int indent) const override; | ||||
| 
 | ||||
|     bool has_export(FlyString const& export_name) const; | ||||
|     bool has_export(DeprecatedFlyString const& export_name) const; | ||||
| 
 | ||||
|     bool has_statement() const { return m_statement; } | ||||
|     Vector<ExportEntry> const& entries() const { return m_entries; } | ||||
|  | @ -592,7 +592,7 @@ public: | |||
|     { | ||||
|     } | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const = 0; | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const = 0; | ||||
| 
 | ||||
|     // 8.1.3 Static Semantics: IsConstantDeclaration, https://tc39.es/ecma262/#sec-static-semantics-isconstantdeclaration
 | ||||
|     virtual bool is_constant_declaration() const { return false; } | ||||
|  | @ -608,7 +608,7 @@ public: | |||
|     } | ||||
|     Completion execute(Interpreter&) const override { return {}; } | ||||
| 
 | ||||
|     ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&&) const override | ||||
|     ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&&) const override | ||||
|     { | ||||
|         VERIFY_NOT_REACHED(); | ||||
|     } | ||||
|  | @ -633,7 +633,7 @@ struct BindingPattern : RefCounted<BindingPattern> { | |||
| 
 | ||||
|     void dump(int indent) const; | ||||
| 
 | ||||
|     ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const; | ||||
|     ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const; | ||||
| 
 | ||||
|     bool contains_expression() const; | ||||
| 
 | ||||
|  | @ -642,14 +642,14 @@ struct BindingPattern : RefCounted<BindingPattern> { | |||
| }; | ||||
| 
 | ||||
| struct FunctionParameter { | ||||
|     Variant<FlyString, NonnullRefPtr<BindingPattern>> binding; | ||||
|     Variant<DeprecatedFlyString, NonnullRefPtr<BindingPattern>> binding; | ||||
|     RefPtr<Expression> default_value; | ||||
|     bool is_rest { false }; | ||||
| }; | ||||
| 
 | ||||
| class FunctionNode { | ||||
| public: | ||||
|     FlyString const& name() const { return m_name; } | ||||
|     DeprecatedFlyString const& name() const { return m_name; } | ||||
|     DeprecatedString const& source_text() const { return m_source_text; } | ||||
|     Statement const& body() const { return *m_body; } | ||||
|     Vector<FunctionParameter> const& parameters() const { return m_parameters; }; | ||||
|  | @ -661,7 +661,7 @@ public: | |||
|     FunctionKind kind() const { return m_kind; } | ||||
| 
 | ||||
| protected: | ||||
|     FunctionNode(FlyString name, DeprecatedString source_text, NonnullRefPtr<Statement> body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function) | ||||
|     FunctionNode(DeprecatedFlyString name, DeprecatedString source_text, NonnullRefPtr<Statement> body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function) | ||||
|         : m_name(move(name)) | ||||
|         , m_source_text(move(source_text)) | ||||
|         , m_body(move(body)) | ||||
|  | @ -680,7 +680,7 @@ protected: | |||
|     void dump(int indent, DeprecatedString const& class_name) const; | ||||
| 
 | ||||
| private: | ||||
|     FlyString m_name; | ||||
|     DeprecatedFlyString m_name; | ||||
|     DeprecatedString m_source_text; | ||||
|     NonnullRefPtr<Statement> m_body; | ||||
|     Vector<FunctionParameter> const m_parameters; | ||||
|  | @ -698,7 +698,7 @@ class FunctionDeclaration final | |||
| public: | ||||
|     static bool must_have_name() { return true; } | ||||
| 
 | ||||
|     FunctionDeclaration(SourceRange source_range, FlyString const& name, DeprecatedString source_text, NonnullRefPtr<Statement> body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval) | ||||
|     FunctionDeclaration(SourceRange source_range, DeprecatedFlyString const& name, DeprecatedString source_text, NonnullRefPtr<Statement> body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval) | ||||
|         : Declaration(source_range) | ||||
|         , FunctionNode(name, move(source_text), move(body), move(parameters), function_length, kind, is_strict_mode, might_need_arguments_object, contains_direct_call_to_eval, false) | ||||
|     { | ||||
|  | @ -708,7 +708,7 @@ public: | |||
|     virtual void dump(int indent) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const override; | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const override; | ||||
| 
 | ||||
|     virtual bool is_function_declaration() const override { return true; } | ||||
| 
 | ||||
|  | @ -724,7 +724,7 @@ class FunctionExpression final | |||
| public: | ||||
|     static bool must_have_name() { return false; } | ||||
| 
 | ||||
|     FunctionExpression(SourceRange source_range, FlyString const& name, DeprecatedString source_text, NonnullRefPtr<Statement> body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function = false) | ||||
|     FunctionExpression(SourceRange source_range, DeprecatedFlyString const& name, DeprecatedString source_text, NonnullRefPtr<Statement> body, Vector<FunctionParameter> parameters, i32 function_length, FunctionKind kind, bool is_strict_mode, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function = false) | ||||
|         : Expression(source_range) | ||||
|         , FunctionNode(name, move(source_text), move(body), move(parameters), function_length, kind, is_strict_mode, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function) | ||||
|     { | ||||
|  | @ -737,7 +737,7 @@ public: | |||
| 
 | ||||
|     bool has_name() const { return !name().is_empty(); } | ||||
| 
 | ||||
|     Value instantiate_ordinary_function_expression(Interpreter&, FlyString given_name) const; | ||||
|     Value instantiate_ordinary_function_expression(Interpreter&, DeprecatedFlyString given_name) const; | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_function_expression() const override { return true; } | ||||
|  | @ -845,10 +845,10 @@ public: | |||
|     Statement const& body() const { return *m_body; } | ||||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const override; | ||||
| 
 | ||||
| private: | ||||
|     NonnullRefPtr<Expression> m_test; | ||||
|  | @ -868,10 +868,10 @@ public: | |||
|     Statement const& body() const { return *m_body; } | ||||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const override; | ||||
| 
 | ||||
| private: | ||||
|     NonnullRefPtr<Expression> m_test; | ||||
|  | @ -916,10 +916,10 @@ public: | |||
|     Statement const& body() const { return *m_body; } | ||||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const override; | ||||
| 
 | ||||
| private: | ||||
|     RefPtr<ASTNode> m_init; | ||||
|  | @ -944,8 +944,8 @@ public: | |||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
| 
 | ||||
| private: | ||||
|  | @ -970,8 +970,8 @@ public: | |||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
| 
 | ||||
| private: | ||||
|  | @ -991,7 +991,7 @@ public: | |||
|     } | ||||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<FlyString> const&) const override; | ||||
|     virtual Completion loop_evaluation(Interpreter&, Vector<DeprecatedFlyString> const&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
| 
 | ||||
| private: | ||||
|  | @ -1236,13 +1236,13 @@ private: | |||
| 
 | ||||
| class Identifier final : public Expression { | ||||
| public: | ||||
|     explicit Identifier(SourceRange source_range, FlyString string) | ||||
|     explicit Identifier(SourceRange source_range, DeprecatedFlyString string) | ||||
|         : Expression(source_range) | ||||
|         , m_string(move(string)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     FlyString const& string() const { return m_string; } | ||||
|     DeprecatedFlyString const& string() const { return m_string; } | ||||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
|  | @ -1252,19 +1252,19 @@ public: | |||
| private: | ||||
|     virtual bool is_identifier() const override { return true; } | ||||
| 
 | ||||
|     FlyString m_string; | ||||
|     DeprecatedFlyString m_string; | ||||
|     mutable EnvironmentCoordinate m_cached_environment_coordinate; | ||||
| }; | ||||
| 
 | ||||
| class PrivateIdentifier final : public Expression { | ||||
| public: | ||||
|     explicit PrivateIdentifier(SourceRange source_range, FlyString string) | ||||
|     explicit PrivateIdentifier(SourceRange source_range, DeprecatedFlyString string) | ||||
|         : Expression(source_range) | ||||
|         , m_string(move(string)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     FlyString const& string() const { return m_string; } | ||||
|     DeprecatedFlyString const& string() const { return m_string; } | ||||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual void dump(int indent) const override; | ||||
|  | @ -1272,7 +1272,7 @@ public: | |||
|     virtual bool is_private_identifier() const override { return true; } | ||||
| 
 | ||||
| private: | ||||
|     FlyString m_string; | ||||
|     DeprecatedFlyString m_string; | ||||
| }; | ||||
| 
 | ||||
| class ClassElement : public ASTNode { | ||||
|  | @ -1298,7 +1298,7 @@ public: | |||
|     using ClassValue = Variant<ClassFieldDefinition, Completion, PrivateElement>; | ||||
|     virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const = 0; | ||||
| 
 | ||||
|     virtual Optional<FlyString> private_bound_identifier() const { return {}; }; | ||||
|     virtual Optional<DeprecatedFlyString> private_bound_identifier() const { return {}; }; | ||||
| 
 | ||||
| private: | ||||
|     bool m_is_static { false }; | ||||
|  | @ -1326,7 +1326,7 @@ public: | |||
| 
 | ||||
|     virtual void dump(int indent) const override; | ||||
|     virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const override; | ||||
|     virtual Optional<FlyString> private_bound_identifier() const override; | ||||
|     virtual Optional<DeprecatedFlyString> private_bound_identifier() const override; | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_class_method() const override { return true; } | ||||
|  | @ -1353,7 +1353,7 @@ public: | |||
| 
 | ||||
|     virtual void dump(int indent) const override; | ||||
|     virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, Object& home_object) const override; | ||||
|     virtual Optional<FlyString> private_bound_identifier() const override; | ||||
|     virtual Optional<DeprecatedFlyString> private_bound_identifier() const override; | ||||
| 
 | ||||
| private: | ||||
|     NonnullRefPtr<Expression> m_key; | ||||
|  | @ -1415,7 +1415,7 @@ public: | |||
| 
 | ||||
|     bool has_name() const { return !m_name.is_empty(); } | ||||
| 
 | ||||
|     ThrowCompletionOr<ECMAScriptFunctionObject*> class_definition_evaluation(Interpreter&, FlyString const& binding_name = {}, FlyString const& class_name = {}) const; | ||||
|     ThrowCompletionOr<ECMAScriptFunctionObject*> class_definition_evaluation(Interpreter&, DeprecatedFlyString const& binding_name = {}, DeprecatedFlyString const& class_name = {}) const; | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_class_expression() const override { return true; } | ||||
|  | @ -1439,7 +1439,7 @@ public: | |||
|     virtual void dump(int indent) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const override; | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const override; | ||||
| 
 | ||||
|     virtual bool is_lexical_declaration() const override { return true; } | ||||
| 
 | ||||
|  | @ -1706,7 +1706,7 @@ public: | |||
| 
 | ||||
|     NonnullRefPtrVector<VariableDeclarator> const& declarations() const { return m_declarations; } | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<FlyString const&>&& callback) const override; | ||||
|     virtual ThrowCompletionOr<void> for_each_bound_name(ThrowCompletionOrVoidCallback<DeprecatedFlyString const&>&& callback) const override; | ||||
| 
 | ||||
|     virtual bool is_constant_declaration() const override { return m_declaration_kind == DeclarationKind::Const; }; | ||||
| 
 | ||||
|  | @ -1985,7 +1985,7 @@ private: | |||
| 
 | ||||
| class CatchClause final : public ASTNode { | ||||
| public: | ||||
|     CatchClause(SourceRange source_range, FlyString parameter, NonnullRefPtr<BlockStatement> body) | ||||
|     CatchClause(SourceRange source_range, DeprecatedFlyString parameter, NonnullRefPtr<BlockStatement> body) | ||||
|         : ASTNode(source_range) | ||||
|         , m_parameter(move(parameter)) | ||||
|         , m_body(move(body)) | ||||
|  | @ -2006,7 +2006,7 @@ public: | |||
|     virtual Completion execute(Interpreter&) const override; | ||||
| 
 | ||||
| private: | ||||
|     Variant<FlyString, NonnullRefPtr<BindingPattern>> m_parameter; | ||||
|     Variant<DeprecatedFlyString, NonnullRefPtr<BindingPattern>> m_parameter; | ||||
|     NonnullRefPtr<BlockStatement> m_body; | ||||
| }; | ||||
| 
 | ||||
|  | @ -2080,7 +2080,7 @@ public: | |||
|     virtual void dump(int indent) const override; | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const; | ||||
| 
 | ||||
|     Completion execute_impl(Interpreter&) const; | ||||
|     void add_case(NonnullRefPtr<SwitchCase> switch_case) { m_cases.append(move(switch_case)); } | ||||
|  | @ -2092,7 +2092,7 @@ private: | |||
| 
 | ||||
| class BreakStatement final : public Statement { | ||||
| public: | ||||
|     BreakStatement(SourceRange source_range, FlyString target_label) | ||||
|     BreakStatement(SourceRange source_range, DeprecatedFlyString target_label) | ||||
|         : Statement(source_range) | ||||
|         , m_target_label(move(target_label)) | ||||
|     { | ||||
|  | @ -2100,16 +2100,16 @@ public: | |||
| 
 | ||||
|     virtual Completion execute(Interpreter&) const override; | ||||
| 
 | ||||
|     FlyString const& target_label() const { return m_target_label; } | ||||
|     DeprecatedFlyString const& target_label() const { return m_target_label; } | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
| 
 | ||||
| private: | ||||
|     FlyString m_target_label; | ||||
|     DeprecatedFlyString m_target_label; | ||||
| }; | ||||
| 
 | ||||
| class ContinueStatement final : public Statement { | ||||
| public: | ||||
|     ContinueStatement(SourceRange source_range, FlyString target_label) | ||||
|     ContinueStatement(SourceRange source_range, DeprecatedFlyString target_label) | ||||
|         : Statement(source_range) | ||||
|         , m_target_label(move(target_label)) | ||||
|     { | ||||
|  | @ -2118,10 +2118,10 @@ public: | |||
|     virtual Completion execute(Interpreter&) const override; | ||||
|     virtual Bytecode::CodeGenerationErrorOr<void> generate_bytecode(Bytecode::Generator&) const override; | ||||
| 
 | ||||
|     FlyString const& target_label() const { return m_target_label; } | ||||
|     DeprecatedFlyString const& target_label() const { return m_target_label; } | ||||
| 
 | ||||
| private: | ||||
|     FlyString m_target_label; | ||||
|     DeprecatedFlyString m_target_label; | ||||
| }; | ||||
| 
 | ||||
| class DebuggerStatement final : public Statement { | ||||
|  |  | |||
|  | @ -109,7 +109,7 @@ Bytecode::CodeGenerationErrorOr<void> ScopeNode::generate_bytecode(Bytecode::Gen | |||
|         Vector<FunctionDeclaration const&> functions_to_initialize; | ||||
| 
 | ||||
|         // 7. Let declaredFunctionNames be a new empty List.
 | ||||
|         HashTable<FlyString> declared_function_names; | ||||
|         HashTable<DeprecatedFlyString> declared_function_names; | ||||
| 
 | ||||
|         // 8. For each element d of varDeclarations, in reverse List order, do
 | ||||
|         (void)for_each_var_function_declaration_in_reverse_order([&](FunctionDeclaration const& function) -> ThrowCompletionOr<void> { | ||||
|  | @ -135,7 +135,7 @@ Bytecode::CodeGenerationErrorOr<void> ScopeNode::generate_bytecode(Bytecode::Gen | |||
|         }); | ||||
| 
 | ||||
|         // 9. Let declaredVarNames be a new empty List.
 | ||||
|         HashTable<FlyString> declared_var_names; | ||||
|         HashTable<DeprecatedFlyString> declared_var_names; | ||||
| 
 | ||||
|         // 10. For each element d of varDeclarations, do
 | ||||
|         (void)for_each_var_scoped_variable_declaration([&](Declaration const& declaration) { | ||||
|  | @ -803,7 +803,7 @@ Bytecode::CodeGenerationErrorOr<void> LabelledStatement::generate_bytecode(Bytec | |||
| 
 | ||||
| // 14.13.4 Runtime Semantics: LabelledEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-labelledevaluation
 | ||||
| // LabelledStatement : LabelIdentifier : LabelledItem
 | ||||
| Bytecode::CodeGenerationErrorOr<void> LabelledStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> LabelledStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     // Convert the m_labelled_item NNRP to a reference early so we don't have to do it every single time we want to use it.
 | ||||
|     auto const& labelled_item = *m_labelled_item; | ||||
|  | @ -853,7 +853,7 @@ Bytecode::CodeGenerationErrorOr<void> LabelledStatement::generate_labelled_evalu | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> IterationStatement::generate_labelled_evaluation(Bytecode::Generator&, Vector<FlyString> const&) const | ||||
| Bytecode::CodeGenerationErrorOr<void> IterationStatement::generate_labelled_evaluation(Bytecode::Generator&, Vector<DeprecatedFlyString> const&) const | ||||
| { | ||||
|     return Bytecode::CodeGenerationError { | ||||
|         this, | ||||
|  | @ -866,7 +866,7 @@ Bytecode::CodeGenerationErrorOr<void> WhileStatement::generate_bytecode(Bytecode | |||
|     return generate_labelled_evaluation(generator, {}); | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> WhileStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> WhileStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     // test
 | ||||
|     // jump if_false (true) end (false) body
 | ||||
|  | @ -916,7 +916,7 @@ Bytecode::CodeGenerationErrorOr<void> DoWhileStatement::generate_bytecode(Byteco | |||
|     return generate_labelled_evaluation(generator, {}); | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> DoWhileStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> DoWhileStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     // jump always (true) body
 | ||||
|     // test
 | ||||
|  | @ -967,7 +967,7 @@ Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_bytecode(Bytecode:: | |||
|     return generate_labelled_evaluation(generator, {}); | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> ForStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     // init
 | ||||
|     // jump always (true) test
 | ||||
|  | @ -2215,7 +2215,7 @@ Bytecode::CodeGenerationErrorOr<void> TryStatement::generate_bytecode(Bytecode:: | |||
| 
 | ||||
|         generator.begin_variable_scope(Bytecode::Generator::BindingMode::Lexical, Bytecode::Generator::SurroundingScopeKind::Block); | ||||
|         TRY(m_handler->parameter().visit( | ||||
|             [&](FlyString const& parameter) -> Bytecode::CodeGenerationErrorOr<void> { | ||||
|             [&](DeprecatedFlyString const& parameter) -> Bytecode::CodeGenerationErrorOr<void> { | ||||
|                 if (!parameter.is_empty()) { | ||||
|                     auto parameter_identifier = generator.intern_identifier(parameter); | ||||
|                     generator.register_binding(parameter_identifier); | ||||
|  | @ -2283,7 +2283,7 @@ Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_bytecode(Bytecod | |||
|     return generate_labelled_evaluation(generator, {}); | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> SwitchStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     auto discriminant_reg = generator.allocate_register(); | ||||
|     TRY(m_discriminant->generate_bytecode(generator)); | ||||
|  | @ -2516,7 +2516,7 @@ static Bytecode::CodeGenerationErrorOr<ForInOfHeadEvaluationResult> for_in_of_he | |||
| } | ||||
| 
 | ||||
| // 14.7.5.7 ForIn/OfBodyEvaluation ( lhs, stmt, iteratorRecord, iterationKind, lhsKind, labelSet [ , iteratorKind ] ), https://tc39.es/ecma262/#sec-runtime-semantics-forin-div-ofbodyevaluation-lhs-stmt-iterator-lhskind-labelset
 | ||||
| static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode::Generator& generator, ASTNode const& node, Variant<NonnullRefPtr<ASTNode>, NonnullRefPtr<BindingPattern>> const& lhs, ASTNode const& body, ForInOfHeadEvaluationResult const& head_result, Vector<FlyString> const& label_set, Bytecode::BasicBlock& loop_end, Bytecode::BasicBlock& loop_update) | ||||
| static Bytecode::CodeGenerationErrorOr<void> for_in_of_body_evaluation(Bytecode::Generator& generator, ASTNode const& node, Variant<NonnullRefPtr<ASTNode>, NonnullRefPtr<BindingPattern>> const& lhs, ASTNode const& body, ForInOfHeadEvaluationResult const& head_result, Vector<DeprecatedFlyString> const& label_set, Bytecode::BasicBlock& loop_end, Bytecode::BasicBlock& loop_update) | ||||
| { | ||||
|     auto iterator_register = generator.allocate_register(); | ||||
|     generator.emit<Bytecode::Op::Store>(iterator_register); | ||||
|  | @ -2719,7 +2719,7 @@ Bytecode::CodeGenerationErrorOr<void> ForInStatement::generate_bytecode(Bytecode | |||
| } | ||||
| 
 | ||||
| // 14.7.5.5 Runtime Semantics: ForInOfLoopEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-forinofloopevaluation
 | ||||
| Bytecode::CodeGenerationErrorOr<void> ForInStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> ForInStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     auto& loop_end = generator.make_block(); | ||||
|     auto& loop_update = generator.make_block(); | ||||
|  | @ -2736,7 +2736,7 @@ Bytecode::CodeGenerationErrorOr<void> ForOfStatement::generate_bytecode(Bytecode | |||
|     return generate_labelled_evaluation(generator, {}); | ||||
| } | ||||
| 
 | ||||
| Bytecode::CodeGenerationErrorOr<void> ForOfStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<FlyString> const& label_set) const | ||||
| Bytecode::CodeGenerationErrorOr<void> ForOfStatement::generate_labelled_evaluation(Bytecode::Generator& generator, Vector<DeprecatedFlyString> const& label_set) const | ||||
| { | ||||
|     auto& loop_end = generator.make_block(); | ||||
|     auto& loop_update = generator.make_block(); | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/NonnullOwnPtrVector.h> | ||||
| #include <LibJS/Bytecode/BasicBlock.h> | ||||
| #include <LibJS/Bytecode/IdentifierTable.h> | ||||
|  | @ -15,7 +15,7 @@ | |||
| namespace JS::Bytecode { | ||||
| 
 | ||||
| struct Executable { | ||||
|     FlyString name; | ||||
|     DeprecatedFlyString name; | ||||
|     NonnullOwnPtrVector<BasicBlock> basic_blocks; | ||||
|     NonnullOwnPtr<StringTable> string_table; | ||||
|     NonnullOwnPtr<IdentifierTable> identifier_table; | ||||
|  | @ -23,7 +23,7 @@ struct Executable { | |||
|     bool is_strict_mode { false }; | ||||
| 
 | ||||
|     DeprecatedString const& get_string(StringTableIndex index) const { return string_table->get(index); } | ||||
|     FlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); } | ||||
|     DeprecatedFlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); } | ||||
| 
 | ||||
|     void dump() const; | ||||
| }; | ||||
|  |  | |||
|  | @ -113,7 +113,7 @@ void Generator::end_variable_scope() | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void Generator::begin_continuable_scope(Label continue_target, Vector<FlyString> const& language_label_set) | ||||
| void Generator::begin_continuable_scope(Label continue_target, Vector<DeprecatedFlyString> const& language_label_set) | ||||
| { | ||||
|     m_continuable_scopes.append({ continue_target, language_label_set }); | ||||
|     start_boundary(BlockBoundaryType::Continue); | ||||
|  | @ -130,7 +130,7 @@ Label Generator::nearest_breakable_scope() const | |||
|     return m_breakable_scopes.last().bytecode_target; | ||||
| } | ||||
| 
 | ||||
| void Generator::begin_breakable_scope(Label breakable_target, Vector<FlyString> const& language_label_set) | ||||
| void Generator::begin_breakable_scope(Label breakable_target, Vector<DeprecatedFlyString> const& language_label_set) | ||||
| { | ||||
|     m_breakable_scopes.append({ breakable_target, language_label_set }); | ||||
|     start_boundary(BlockBoundaryType::Break); | ||||
|  | @ -262,7 +262,7 @@ CodeGenerationErrorOr<void> Generator::emit_delete_reference(JS::ASTNode const& | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| Label Generator::perform_needed_unwinds_for_labelled_break_and_return_target_block(FlyString const& break_label) | ||||
| Label Generator::perform_needed_unwinds_for_labelled_break_and_return_target_block(DeprecatedFlyString const& break_label) | ||||
| { | ||||
|     size_t current_boundary = m_boundaries.size(); | ||||
|     for (auto& breakable_scope : m_breakable_scopes.in_reverse()) { | ||||
|  | @ -294,7 +294,7 @@ Label Generator::perform_needed_unwinds_for_labelled_break_and_return_target_blo | |||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| Label Generator::perform_needed_unwinds_for_labelled_continue_and_return_target_block(FlyString const& continue_label) | ||||
| Label Generator::perform_needed_unwinds_for_labelled_continue_and_return_target_block(DeprecatedFlyString const& continue_label) | ||||
| { | ||||
|     size_t current_boundary = m_boundaries.size(); | ||||
|     for (auto& continuable_scope : m_continuable_scopes.in_reverse()) { | ||||
|  |  | |||
|  | @ -84,9 +84,9 @@ public: | |||
|     CodeGenerationErrorOr<void> emit_store_to_reference(JS::ASTNode const&); | ||||
|     CodeGenerationErrorOr<void> emit_delete_reference(JS::ASTNode const&); | ||||
| 
 | ||||
|     void begin_continuable_scope(Label continue_target, Vector<FlyString> const& language_label_set); | ||||
|     void begin_continuable_scope(Label continue_target, Vector<DeprecatedFlyString> const& language_label_set); | ||||
|     void end_continuable_scope(); | ||||
|     void begin_breakable_scope(Label breakable_target, Vector<FlyString> const& language_label_set); | ||||
|     void begin_breakable_scope(Label breakable_target, Vector<DeprecatedFlyString> const& language_label_set); | ||||
|     void end_breakable_scope(); | ||||
| 
 | ||||
|     [[nodiscard]] Label nearest_continuable_scope() const; | ||||
|  | @ -117,7 +117,7 @@ public: | |||
|         return m_string_table->insert(move(string)); | ||||
|     } | ||||
| 
 | ||||
|     IdentifierTableIndex intern_identifier(FlyString string) | ||||
|     IdentifierTableIndex intern_identifier(DeprecatedFlyString string) | ||||
|     { | ||||
|         return m_identifier_table->insert(move(string)); | ||||
|     } | ||||
|  | @ -213,8 +213,8 @@ public: | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     Label perform_needed_unwinds_for_labelled_break_and_return_target_block(FlyString const& break_label); | ||||
|     Label perform_needed_unwinds_for_labelled_continue_and_return_target_block(FlyString const& continue_label); | ||||
|     Label perform_needed_unwinds_for_labelled_break_and_return_target_block(DeprecatedFlyString const& break_label); | ||||
|     Label perform_needed_unwinds_for_labelled_continue_and_return_target_block(DeprecatedFlyString const& continue_label); | ||||
| 
 | ||||
|     void start_boundary(BlockBoundaryType type) { m_boundaries.append(type); } | ||||
|     void end_boundary(BlockBoundaryType type) | ||||
|  | @ -232,7 +232,7 @@ private: | |||
| 
 | ||||
|     struct LabelableScope { | ||||
|         Label bytecode_target; | ||||
|         Vector<FlyString> language_label_set; | ||||
|         Vector<DeprecatedFlyString> language_label_set; | ||||
|     }; | ||||
| 
 | ||||
|     BasicBlock* m_current_basic_block { nullptr }; | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| namespace JS::Bytecode { | ||||
| 
 | ||||
| IdentifierTableIndex IdentifierTable::insert(FlyString string) | ||||
| IdentifierTableIndex IdentifierTable::insert(DeprecatedFlyString string) | ||||
| { | ||||
|     for (size_t i = 0; i < m_identifiers.size(); i++) { | ||||
|         if (m_identifiers[i] == string) | ||||
|  | @ -18,7 +18,7 @@ IdentifierTableIndex IdentifierTable::insert(FlyString string) | |||
|     return m_identifiers.size() - 1; | ||||
| } | ||||
| 
 | ||||
| FlyString const& IdentifierTable::get(IdentifierTableIndex index) const | ||||
| DeprecatedFlyString const& IdentifierTable::get(IdentifierTableIndex index) const | ||||
| { | ||||
|     return m_identifiers[index.value()]; | ||||
| } | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DistinctNumeric.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/Vector.h> | ||||
| 
 | ||||
| namespace JS::Bytecode { | ||||
|  | @ -21,13 +21,13 @@ class IdentifierTable { | |||
| public: | ||||
|     IdentifierTable() = default; | ||||
| 
 | ||||
|     IdentifierTableIndex insert(FlyString); | ||||
|     FlyString const& get(IdentifierTableIndex) const; | ||||
|     IdentifierTableIndex insert(DeprecatedFlyString); | ||||
|     DeprecatedFlyString const& get(IdentifierTableIndex) const; | ||||
|     void dump() const; | ||||
|     bool is_empty() const { return m_identifiers.is_empty(); } | ||||
| 
 | ||||
| private: | ||||
|     Vector<FlyString> m_identifiers; | ||||
|     Vector<DeprecatedFlyString> m_identifiers; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -51,7 +51,7 @@ Interpreter::ValueAndFrame Interpreter::run_and_return_frame(Executable const& e | |||
|     if (vm().execution_context_stack().is_empty() || !vm().running_execution_context().lexical_environment) { | ||||
|         // The "normal" interpreter pushes an execution context without environment so in that case we also want to push one.
 | ||||
|         execution_context.this_value = &m_realm.global_object(); | ||||
|         static FlyString global_execution_context_name = "(*BC* global execution context)"; | ||||
|         static DeprecatedFlyString global_execution_context_name = "(*BC* global execution context)"; | ||||
|         execution_context.function_name = global_execution_context_name; | ||||
|         execution_context.lexical_environment = &m_realm.global_environment(); | ||||
|         execution_context.variable_environment = &m_realm.global_environment(); | ||||
|  |  | |||
|  | @ -7,8 +7,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/Weakable.h> | ||||
| #include <LibJS/Forward.h> | ||||
|  | @ -54,7 +54,7 @@ public: | |||
|             nullptr)); | ||||
| 
 | ||||
|         // NOTE: These are not in the spec.
 | ||||
|         static FlyString global_execution_context_name = "(global execution context)"; | ||||
|         static DeprecatedFlyString global_execution_context_name = "(global execution context)"; | ||||
|         interpreter->m_global_execution_context->function_name = global_execution_context_name; | ||||
| 
 | ||||
|         interpreter->m_realm = make_handle(realm); | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| HashMap<FlyString, TokenType> Lexer::s_keywords; | ||||
| HashMap<DeprecatedFlyString, TokenType> Lexer::s_keywords; | ||||
| HashMap<DeprecatedString, TokenType> Lexer::s_three_char_tokens; | ||||
| HashMap<DeprecatedString, TokenType> Lexer::s_two_char_tokens; | ||||
| HashMap<char, TokenType> Lexer::s_single_char_tokens; | ||||
|  | @ -574,7 +574,7 @@ Token Lexer::next() | |||
|     // bunch of Invalid* tokens (bad numeric literals, unterminated comments etc.)
 | ||||
|     DeprecatedString token_message; | ||||
| 
 | ||||
|     Optional<FlyString> identifier; | ||||
|     Optional<DeprecatedFlyString> identifier; | ||||
|     size_t identifier_length = 0; | ||||
| 
 | ||||
|     if (m_current_token.type() == TokenType::RegexLiteral && !is_eof() && is_ascii_alpha(m_current_char) && !did_consume_whitespace_or_comments) { | ||||
|  |  | |||
|  | @ -79,7 +79,7 @@ private: | |||
| 
 | ||||
|     Optional<size_t> m_hit_invalid_unicode; | ||||
| 
 | ||||
|     static HashMap<FlyString, TokenType> s_keywords; | ||||
|     static HashMap<DeprecatedFlyString, TokenType> s_keywords; | ||||
|     static HashMap<DeprecatedString, TokenType> s_three_char_tokens; | ||||
|     static HashMap<DeprecatedString, TokenType> s_two_char_tokens; | ||||
|     static HashMap<char, TokenType> s_single_char_tokens; | ||||
|  | @ -87,7 +87,7 @@ private: | |||
|     struct ParsedIdentifiers : public RefCounted<ParsedIdentifiers> { | ||||
|         // Resolved identifiers must be kept alive for the duration of the parsing stage, otherwise
 | ||||
|         // the only references to these strings are deleted by the Token destructor.
 | ||||
|         HashTable<FlyString> identifiers; | ||||
|         HashTable<DeprecatedFlyString> identifiers; | ||||
|     }; | ||||
| 
 | ||||
|     RefPtr<ParsedIdentifiers> m_parsed_identifiers; | ||||
|  |  | |||
|  | @ -77,7 +77,7 @@ ThrowCompletionOr<Object*> Module::get_module_namespace(VM& vm) | |||
|         auto exported_names = TRY(get_exported_names(vm)); | ||||
| 
 | ||||
|         // b. Let unambiguousNames be a new empty List.
 | ||||
|         Vector<FlyString> unambiguous_names; | ||||
|         Vector<DeprecatedFlyString> unambiguous_names; | ||||
| 
 | ||||
|         // c. For each element name of exportedNames, do
 | ||||
|         for (auto& name : exported_names) { | ||||
|  | @ -100,7 +100,7 @@ ThrowCompletionOr<Object*> Module::get_module_namespace(VM& vm) | |||
| } | ||||
| 
 | ||||
| // 10.4.6.12 ModuleNamespaceCreate ( module, exports ), https://tc39.es/ecma262/#sec-modulenamespacecreate
 | ||||
| Object* Module::module_namespace_create(VM& vm, Vector<FlyString> unambiguous_names) | ||||
| Object* Module::module_namespace_create(VM& vm, Vector<DeprecatedFlyString> unambiguous_names) | ||||
| { | ||||
|     auto& realm = this->realm(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <LibJS/Heap/GCPtr.h> | ||||
| #include <LibJS/Runtime/Environment.h> | ||||
| #include <LibJS/Runtime/Realm.h> | ||||
|  | @ -37,7 +37,7 @@ struct ResolvedBinding { | |||
| 
 | ||||
|     Type type { Null }; | ||||
|     Module* module { nullptr }; | ||||
|     FlyString export_name; | ||||
|     DeprecatedFlyString export_name; | ||||
| 
 | ||||
|     bool is_valid() const | ||||
|     { | ||||
|  | @ -76,8 +76,8 @@ public: | |||
|     virtual ThrowCompletionOr<void> link(VM& vm) = 0; | ||||
|     virtual ThrowCompletionOr<Promise*> evaluate(VM& vm) = 0; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Vector<FlyString>> get_exported_names(VM& vm, Vector<Module*> export_star_set = {}) = 0; | ||||
|     virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, FlyString const& export_name, Vector<ResolvedBinding> resolve_set = {}) = 0; | ||||
|     virtual ThrowCompletionOr<Vector<DeprecatedFlyString>> get_exported_names(VM& vm, Vector<Module*> export_star_set = {}) = 0; | ||||
|     virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, DeprecatedFlyString const& export_name, Vector<ResolvedBinding> resolve_set = {}) = 0; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<u32> inner_module_linking(VM& vm, Vector<Module*>& stack, u32 index); | ||||
|     virtual ThrowCompletionOr<u32> inner_module_evaluation(VM& vm, Vector<Module*>& stack, u32 index); | ||||
|  | @ -93,7 +93,7 @@ protected: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     Object* module_namespace_create(VM& vm, Vector<FlyString> unambiguous_names); | ||||
|     Object* module_namespace_create(VM& vm, Vector<DeprecatedFlyString> unambiguous_names); | ||||
| 
 | ||||
|     // These handles are only safe as long as the VM they live in is valid.
 | ||||
|     // But evaluated modules SHOULD be stored in the VM so unless you intentionally
 | ||||
|  |  | |||
|  | @ -65,7 +65,7 @@ public: | |||
|         scope_pusher.m_function_parameters = parameters; | ||||
|         for (auto& parameter : parameters) { | ||||
|             parameter.binding.visit( | ||||
|                 [&](FlyString const& name) { | ||||
|                 [&](DeprecatedFlyString const& name) { | ||||
|                     scope_pusher.m_forbidden_lexical_names.set(name); | ||||
|                 }, | ||||
|                 [&](NonnullRefPtr<BindingPattern> const& binding_pattern) { | ||||
|  | @ -102,7 +102,7 @@ public: | |||
|         return scope_pusher; | ||||
|     } | ||||
| 
 | ||||
|     static ScopePusher catch_scope(Parser& parser, RefPtr<BindingPattern> const& pattern, FlyString const& parameter) | ||||
|     static ScopePusher catch_scope(Parser& parser, RefPtr<BindingPattern> const& pattern, DeprecatedFlyString const& parameter) | ||||
|     { | ||||
|         ScopePusher scope_pusher(parser, nullptr, ScopeLevel::NotTopLevel); | ||||
|         if (pattern) { | ||||
|  | @ -208,7 +208,7 @@ public: | |||
|     ScopePusher* parent_scope() { return m_parent_scope; } | ||||
|     ScopePusher const* parent_scope() const { return m_parent_scope; } | ||||
| 
 | ||||
|     [[nodiscard]] bool has_declaration(FlyString const& name) const | ||||
|     [[nodiscard]] bool has_declaration(DeprecatedFlyString const& name) const | ||||
|     { | ||||
|         return m_lexical_names.contains(name) || m_var_names.contains(name) || !m_functions_to_hoist.find_if([&name](auto& function) { return function->name() == name; }).is_end(); | ||||
|     } | ||||
|  | @ -254,7 +254,7 @@ public: | |||
|     } | ||||
| 
 | ||||
| private: | ||||
|     void throw_identifier_declared(FlyString const& name, NonnullRefPtr<Declaration> const& declaration) | ||||
|     void throw_identifier_declared(DeprecatedFlyString const& name, NonnullRefPtr<Declaration> const& declaration) | ||||
|     { | ||||
|         m_parser.syntax_error(DeprecatedString::formatted("Identifier '{}' already declared", name), declaration->source_range().start); | ||||
|     } | ||||
|  | @ -266,12 +266,12 @@ private: | |||
|     ScopePusher* m_parent_scope { nullptr }; | ||||
|     ScopePusher* m_top_level_scope { nullptr }; | ||||
| 
 | ||||
|     HashTable<FlyString> m_lexical_names; | ||||
|     HashTable<FlyString> m_var_names; | ||||
|     HashTable<FlyString> m_function_names; | ||||
|     HashTable<DeprecatedFlyString> m_lexical_names; | ||||
|     HashTable<DeprecatedFlyString> m_var_names; | ||||
|     HashTable<DeprecatedFlyString> m_function_names; | ||||
| 
 | ||||
|     HashTable<FlyString> m_forbidden_lexical_names; | ||||
|     HashTable<FlyString> m_forbidden_var_names; | ||||
|     HashTable<DeprecatedFlyString> m_forbidden_lexical_names; | ||||
|     HashTable<DeprecatedFlyString> m_forbidden_var_names; | ||||
|     NonnullRefPtrVector<FunctionDeclaration> m_functions_to_hoist; | ||||
| 
 | ||||
|     Optional<Vector<FunctionParameter>> m_function_parameters; | ||||
|  | @ -707,7 +707,7 @@ static bool is_strict_reserved_word(StringView str) | |||
| static bool is_simple_parameter_list(Vector<FunctionParameter> const& parameters) | ||||
| { | ||||
|     return all_of(parameters, [](FunctionParameter const& parameter) { | ||||
|         return !parameter.is_rest && parameter.default_value.is_null() && parameter.binding.has<FlyString>(); | ||||
|         return !parameter.is_rest && parameter.default_value.is_null() && parameter.binding.has<DeprecatedFlyString>(); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
|  | @ -782,7 +782,7 @@ RefPtr<FunctionExpression> Parser::try_parse_arrow_function_expression(bool expe | |||
|             syntax_error("BindingIdentifier may not be 'arguments' or 'eval' in strict mode"); | ||||
|         if (is_async && token.value() == "await"sv) | ||||
|             syntax_error("'await' is a reserved identifier in async functions"); | ||||
|         parameters.append({ FlyString { token.value() }, {} }); | ||||
|         parameters.append({ DeprecatedFlyString { token.value() }, {} }); | ||||
|     } | ||||
|     // If there's a newline between the closing paren and arrow it's not a valid arrow function,
 | ||||
|     // ASI should kick in instead (it'll then fail with "Unexpected token Arrow")
 | ||||
|  | @ -844,7 +844,7 @@ RefPtr<FunctionExpression> Parser::try_parse_arrow_function_expression(bool expe | |||
|     if (body->in_strict_mode()) { | ||||
|         for (auto& parameter : parameters) { | ||||
|             parameter.binding.visit( | ||||
|                 [&](FlyString const& name) { | ||||
|                 [&](DeprecatedFlyString const& name) { | ||||
|                     check_identifier_name_for_assignment_validity(name, true); | ||||
|                 }, | ||||
|                 [&](auto const&) {}); | ||||
|  | @ -1046,10 +1046,10 @@ NonnullRefPtr<ClassExpression> Parser::parse_class_expression(bool expect_class_ | |||
|     NonnullRefPtrVector<ClassElement> elements; | ||||
|     RefPtr<Expression> super_class; | ||||
|     RefPtr<FunctionExpression> constructor; | ||||
|     HashTable<FlyString> found_private_names; | ||||
|     HashTable<DeprecatedFlyString> found_private_names; | ||||
| 
 | ||||
|     FlyString class_name = expect_class_name || match_identifier() || match(TokenType::Yield) || match(TokenType::Await) | ||||
|         ? consume_identifier_reference().flystring_value() | ||||
|     DeprecatedFlyString class_name = expect_class_name || match_identifier() || match(TokenType::Yield) || match(TokenType::Await) | ||||
|         ? consume_identifier_reference().DeprecatedFlyString_value() | ||||
|         : ""; | ||||
| 
 | ||||
|     check_identifier_name_for_assignment_validity(class_name, true); | ||||
|  | @ -1331,7 +1331,7 @@ NonnullRefPtr<ClassExpression> Parser::parse_class_expression(bool expect_class_ | |||
|             //          this function does not.
 | ||||
|             //          So we use a custom version of SuperCall which doesn't use the @@iterator
 | ||||
|             //          method on %Array.prototype% visibly.
 | ||||
|             FlyString argument_name = "args"; | ||||
|             DeprecatedFlyString argument_name = "args"; | ||||
|             auto super_call = create_ast_node<SuperCall>( | ||||
|                 { m_source_code, rule_start.position(), position() }, | ||||
|                 SuperCall::IsPartOfSyntheticConstructor::Yes, | ||||
|  | @ -1728,7 +1728,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression() | |||
|                 property_key = parse_property_key(); | ||||
|             } else { | ||||
|                 property_key = create_ast_node<StringLiteral>({ m_source_code, rule_start.position(), position() }, identifier.value()); | ||||
|                 property_value = create_ast_node<Identifier>({ m_source_code, rule_start.position(), position() }, identifier.flystring_value()); | ||||
|                 property_value = create_ast_node<Identifier>({ m_source_code, rule_start.position(), position() }, identifier.DeprecatedFlyString_value()); | ||||
|             } | ||||
|         } else { | ||||
|             property_key = parse_property_key(); | ||||
|  | @ -2145,7 +2145,7 @@ Parser::ExpressionResult Parser::parse_secondary_expression(NonnullRefPtr<Expres | |||
|             expected("IdentifierName"); | ||||
|         } | ||||
| 
 | ||||
|         return create_ast_node<MemberExpression>({ m_source_code, rule_start.position(), position() }, move(lhs), create_ast_node<Identifier>({ m_source_code, rule_start.position(), position() }, consume().flystring_value())); | ||||
|         return create_ast_node<MemberExpression>({ m_source_code, rule_start.position(), position() }, move(lhs), create_ast_node<Identifier>({ m_source_code, rule_start.position(), position() }, consume().DeprecatedFlyString_value())); | ||||
|     case TokenType::BracketOpen: { | ||||
|         consume(TokenType::BracketOpen); | ||||
|         auto expression = create_ast_node<MemberExpression>({ m_source_code, rule_start.position(), position() }, move(lhs), parse_expression(0), true); | ||||
|  | @ -2322,7 +2322,7 @@ NonnullRefPtr<Identifier> Parser::parse_identifier() | |||
|         syntax_error("'arguments' is not allowed in class field initializer"); | ||||
|     return create_ast_node<Identifier>( | ||||
|         { m_source_code, identifier_start, position() }, | ||||
|         token.flystring_value()); | ||||
|         token.DeprecatedFlyString_value()); | ||||
| } | ||||
| 
 | ||||
| Vector<CallExpression::Argument> Parser::parse_arguments() | ||||
|  | @ -2501,7 +2501,7 @@ NonnullRefPtr<FunctionBody> Parser::parse_function_body(Vector<FunctionParameter | |||
|         Vector<StringView> parameter_names; | ||||
|         for (auto& parameter : parameters) { | ||||
|             parameter.binding.visit( | ||||
|                 [&](FlyString const& parameter_name) { | ||||
|                 [&](DeprecatedFlyString const& parameter_name) { | ||||
|                     check_identifier_name_for_assignment_validity(parameter_name, function_body->in_strict_mode()); | ||||
|                     if (function_kind == FunctionKind::Generator && parameter_name == "yield"sv) | ||||
|                         syntax_error("Parameter name 'yield' not allowed in this context"); | ||||
|  | @ -2579,7 +2579,7 @@ NonnullRefPtr<FunctionNodeType> Parser::parse_function_node(u16 parse_options, O | |||
|         function_kind = FunctionKind::Async; | ||||
|     else | ||||
|         function_kind = FunctionKind::Normal; | ||||
|     FlyString name; | ||||
|     DeprecatedFlyString name; | ||||
|     if (parse_options & FunctionNodeParseOptions::CheckForFunctionAndName) { | ||||
|         if (function_kind == FunctionKind::Normal && match(TokenType::Async) && !next_token().trivia_contains_line_terminator()) { | ||||
|             function_kind = FunctionKind::Async; | ||||
|  | @ -2596,9 +2596,9 @@ NonnullRefPtr<FunctionNodeType> Parser::parse_function_node(u16 parse_options, O | |||
|         if (parse_options & FunctionNodeParseOptions::HasDefaultExportName) | ||||
|             name = ExportStatement::local_name_for_default; | ||||
|         else if (FunctionNodeType::must_have_name() || match_identifier()) | ||||
|             name = consume_identifier().flystring_value(); | ||||
|             name = consume_identifier().DeprecatedFlyString_value(); | ||||
|         else if (is_function_expression && (match(TokenType::Yield) || match(TokenType::Await))) | ||||
|             name = consume().flystring_value(); | ||||
|             name = consume().DeprecatedFlyString_value(); | ||||
| 
 | ||||
|         check_identifier_name_for_assignment_validity(name); | ||||
| 
 | ||||
|  | @ -2656,18 +2656,18 @@ Vector<FunctionParameter> Parser::parse_formal_parameters(int& function_length, | |||
| 
 | ||||
|     Vector<FunctionParameter> parameters; | ||||
| 
 | ||||
|     auto consume_identifier_or_binding_pattern = [&]() -> Variant<FlyString, NonnullRefPtr<BindingPattern>> { | ||||
|     auto consume_identifier_or_binding_pattern = [&]() -> Variant<DeprecatedFlyString, NonnullRefPtr<BindingPattern>> { | ||||
|         if (auto pattern = parse_binding_pattern(AllowDuplicates::No, AllowMemberExpressions::No)) | ||||
|             return pattern.release_nonnull(); | ||||
| 
 | ||||
|         auto token = consume_identifier(); | ||||
|         auto parameter_name = token.flystring_value(); | ||||
|         auto parameter_name = token.DeprecatedFlyString_value(); | ||||
| 
 | ||||
|         check_identifier_name_for_assignment_validity(parameter_name); | ||||
| 
 | ||||
|         for (auto& parameter : parameters) { | ||||
|             bool has_same_name = parameter.binding.visit( | ||||
|                 [&](FlyString const& name) { | ||||
|                 [&](DeprecatedFlyString const& name) { | ||||
|                     return name == parameter_name; | ||||
|                 }, | ||||
|                 [&](NonnullRefPtr<BindingPattern> const& bindings) { | ||||
|  | @ -2695,7 +2695,7 @@ Vector<FunctionParameter> Parser::parse_formal_parameters(int& function_length, | |||
|                 syntax_error(message, Position { token.line_number(), token.line_column() }); | ||||
|             break; | ||||
|         } | ||||
|         return FlyString { token.value() }; | ||||
|         return DeprecatedFlyString { token.value() }; | ||||
|     }; | ||||
| 
 | ||||
|     while (match(TokenType::CurlyOpen) || match(TokenType::BracketOpen) || match_identifier() || match(TokenType::TripleDot)) { | ||||
|  | @ -2743,7 +2743,7 @@ Vector<FunctionParameter> Parser::parse_formal_parameters(int& function_length, | |||
|     return parameters; | ||||
| } | ||||
| 
 | ||||
| static AK::Array<FlyString, 36> s_reserved_words = { "break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "null", "return", "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with" }; | ||||
| static AK::Array<DeprecatedFlyString, 36> s_reserved_words = { "break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "null", "return", "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with" }; | ||||
| 
 | ||||
| RefPtr<BindingPattern> Parser::parse_binding_pattern(Parser::AllowDuplicates allow_duplicates, Parser::AllowMemberExpressions allow_member_expressions) | ||||
| { | ||||
|  | @ -2806,15 +2806,15 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern(Parser::AllowDuplicates all | |||
|                         { m_source_code, rule_start.position(), position() }, | ||||
|                         string_literal->value()); | ||||
|                 } else if (match(TokenType::BigIntLiteral)) { | ||||
|                     auto string_value = consume().flystring_value(); | ||||
|                     auto string_value = consume().DeprecatedFlyString_value(); | ||||
|                     VERIFY(string_value.ends_with("n"sv)); | ||||
|                     name = create_ast_node<Identifier>( | ||||
|                         { m_source_code, rule_start.position(), position() }, | ||||
|                         FlyString(string_value.view().substring_view(0, string_value.length() - 1))); | ||||
|                         DeprecatedFlyString(string_value.view().substring_view(0, string_value.length() - 1))); | ||||
|                 } else { | ||||
|                     name = create_ast_node<Identifier>( | ||||
|                         { m_source_code, rule_start.position(), position() }, | ||||
|                         consume().flystring_value()); | ||||
|                         consume().DeprecatedFlyString_value()); | ||||
|                 } | ||||
|             } else if (match(TokenType::BracketOpen)) { | ||||
|                 consume(); | ||||
|  | @ -2852,7 +2852,7 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern(Parser::AllowDuplicates all | |||
|                 } else if (match_identifier_name()) { | ||||
|                     alias = create_ast_node<Identifier>( | ||||
|                         { m_source_code, rule_start.position(), position() }, | ||||
|                         consume().flystring_value()); | ||||
|                         consume().DeprecatedFlyString_value()); | ||||
| 
 | ||||
|                 } else { | ||||
|                     expected("identifier or binding pattern"); | ||||
|  | @ -2888,7 +2888,7 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern(Parser::AllowDuplicates all | |||
|                 alias = pattern.release_nonnull(); | ||||
|             } else if (match_identifier_name()) { | ||||
|                 // BindingElement must always have an Empty name field
 | ||||
|                 auto identifier_name = consume_identifier().flystring_value(); | ||||
|                 auto identifier_name = consume_identifier().DeprecatedFlyString_value(); | ||||
|                 alias = create_ast_node<Identifier>( | ||||
|                     { m_source_code, rule_start.position(), position() }, | ||||
|                     identifier_name); | ||||
|  | @ -2974,7 +2974,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l | |||
|         Variant<NonnullRefPtr<Identifier>, NonnullRefPtr<BindingPattern>, Empty> target {}; | ||||
|         if (match_identifier()) { | ||||
|             auto identifier_start = push_start(); | ||||
|             auto name = consume_identifier().flystring_value(); | ||||
|             auto name = consume_identifier().DeprecatedFlyString_value(); | ||||
|             target = create_ast_node<Identifier>( | ||||
|                 { m_source_code, rule_start.position(), position() }, | ||||
|                 name); | ||||
|  | @ -2996,14 +2996,14 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l | |||
| 
 | ||||
|             target = create_ast_node<Identifier>( | ||||
|                 { m_source_code, rule_start.position(), position() }, | ||||
|                 consume().flystring_value()); | ||||
|                 consume().DeprecatedFlyString_value()); | ||||
|         } else if (!m_state.await_expression_is_valid && match(TokenType::Async)) { | ||||
|             if (m_program_type == Program::Type::Module) | ||||
|                 syntax_error("Identifier must not be a reserved word in modules ('async')"); | ||||
| 
 | ||||
|             target = create_ast_node<Identifier>( | ||||
|                 { m_source_code, rule_start.position(), position() }, | ||||
|                 consume().flystring_value()); | ||||
|                 consume().DeprecatedFlyString_value()); | ||||
|         } | ||||
| 
 | ||||
|         if (target.has<Empty>()) { | ||||
|  | @ -3070,7 +3070,7 @@ NonnullRefPtr<BreakStatement> Parser::parse_break_statement() | |||
| { | ||||
|     auto rule_start = push_start(); | ||||
|     consume(TokenType::Break); | ||||
|     FlyString target_label; | ||||
|     DeprecatedFlyString target_label; | ||||
|     if (match(TokenType::Semicolon)) { | ||||
|         consume(); | ||||
|     } else { | ||||
|  | @ -3097,7 +3097,7 @@ NonnullRefPtr<ContinueStatement> Parser::parse_continue_statement() | |||
|         syntax_error("'continue' not allow outside of a loop"); | ||||
| 
 | ||||
|     consume(TokenType::Continue); | ||||
|     FlyString target_label; | ||||
|     DeprecatedFlyString target_label; | ||||
|     if (match(TokenType::Semicolon)) { | ||||
|         consume(); | ||||
|         return create_ast_node<ContinueStatement>({ m_source_code, rule_start.position(), position() }, target_label); | ||||
|  | @ -3166,7 +3166,7 @@ NonnullRefPtr<OptionalChain> Parser::parse_optional_chain(NonnullRefPtr<Expressi | |||
|                     auto start = position(); | ||||
|                     auto identifier = consume(); | ||||
|                     chain.append(OptionalChain::MemberReference { | ||||
|                         create_ast_node<Identifier>({ m_source_code, start, position() }, identifier.flystring_value()), | ||||
|                         create_ast_node<Identifier>({ m_source_code, start, position() }, identifier.DeprecatedFlyString_value()), | ||||
|                         OptionalChain::Mode::Optional, | ||||
|                     }); | ||||
|                 } else { | ||||
|  | @ -3192,7 +3192,7 @@ NonnullRefPtr<OptionalChain> Parser::parse_optional_chain(NonnullRefPtr<Expressi | |||
|                 auto start = position(); | ||||
|                 auto identifier = consume(); | ||||
|                 chain.append(OptionalChain::MemberReference { | ||||
|                     create_ast_node<Identifier>({ m_source_code, start, position() }, identifier.flystring_value()), | ||||
|                     create_ast_node<Identifier>({ m_source_code, start, position() }, identifier.DeprecatedFlyString_value()), | ||||
|                     OptionalChain::Mode::NotOptional, | ||||
|                 }); | ||||
|             } else { | ||||
|  | @ -3356,7 +3356,7 @@ NonnullRefPtr<CatchClause> Parser::parse_catch_clause() | |||
|     auto rule_start = push_start(); | ||||
|     consume(TokenType::Catch); | ||||
| 
 | ||||
|     FlyString parameter; | ||||
|     DeprecatedFlyString parameter; | ||||
|     RefPtr<BindingPattern> pattern_parameter; | ||||
|     auto should_expect_parameter = false; | ||||
|     if (match(TokenType::ParenOpen)) { | ||||
|  | @ -3375,7 +3375,7 @@ NonnullRefPtr<CatchClause> Parser::parse_catch_clause() | |||
|     if (should_expect_parameter && parameter.is_empty() && !pattern_parameter) | ||||
|         expected("an identifier or a binding pattern"); | ||||
| 
 | ||||
|     HashTable<FlyString> bound_names; | ||||
|     HashTable<DeprecatedFlyString> bound_names; | ||||
| 
 | ||||
|     if (pattern_parameter) { | ||||
|         pattern_parameter->for_each_bound_name( | ||||
|  | @ -3504,7 +3504,7 @@ NonnullRefPtr<Statement> Parser::parse_for_statement() | |||
|                 m_state.current_scope_pusher->add_declaration(declaration); | ||||
|             } else { | ||||
|                 // This does not follow the normal declaration structure so we need additional checks.
 | ||||
|                 HashTable<FlyString> bound_names; | ||||
|                 HashTable<DeprecatedFlyString> bound_names; | ||||
|                 declaration->for_each_bound_name([&](auto const& name) { | ||||
|                     if (bound_names.set(name) != AK::HashSetResult::InsertedNewEntry) | ||||
|                         syntax_error(DeprecatedString::formatted("Identifier '{}' already declared in for loop initializer", name), declaration->source_range().start); | ||||
|  | @ -4055,7 +4055,7 @@ void Parser::discard_saved_state() | |||
|     m_saved_state.take_last(); | ||||
| } | ||||
| 
 | ||||
| void Parser::check_identifier_name_for_assignment_validity(FlyString const& name, bool force_strict) | ||||
| void Parser::check_identifier_name_for_assignment_validity(DeprecatedFlyString const& name, bool force_strict) | ||||
| { | ||||
|     // FIXME: this is now called from multiple places maybe the error message should be dynamic?
 | ||||
|     if (any_of(s_reserved_words, [&](auto& value) { return name == value; })) { | ||||
|  | @ -4073,11 +4073,11 @@ bool Parser::match_assert_clause() const | |||
|     return !m_state.current_token.trivia_contains_line_terminator() && m_state.current_token.original_value() == "assert"sv; | ||||
| } | ||||
| 
 | ||||
| FlyString Parser::consume_string_value() | ||||
| DeprecatedFlyString Parser::consume_string_value() | ||||
| { | ||||
|     VERIFY(match(TokenType::StringLiteral)); | ||||
|     auto string_token = consume(); | ||||
|     FlyString value = parse_string_literal(string_token)->value(); | ||||
|     DeprecatedFlyString value = parse_string_literal(string_token)->value(); | ||||
| 
 | ||||
|     // This also checks IsStringWellFormedUnicode which makes sure there is no unpaired surrogate
 | ||||
|     // Surrogates are at least 3 bytes
 | ||||
|  | @ -4148,7 +4148,7 @@ ModuleRequest Parser::parse_module_request() | |||
|     return request; | ||||
| } | ||||
| 
 | ||||
| static FlyString default_string_value = "default"; | ||||
| static DeprecatedFlyString default_string_value = "default"; | ||||
| 
 | ||||
| NonnullRefPtr<ImportStatement> Parser::parse_import_statement(Program& program) | ||||
| { | ||||
|  | @ -4237,13 +4237,13 @@ NonnullRefPtr<ImportStatement> Parser::parse_import_statement(Program& program) | |||
|                 // ImportSpecifier :  ImportedBinding
 | ||||
|                 auto require_as = !match_imported_binding(); | ||||
|                 auto name_position = position(); | ||||
|                 auto name = consume().flystring_value(); | ||||
|                 auto name = consume().DeprecatedFlyString_value(); | ||||
| 
 | ||||
|                 if (match_as()) { | ||||
|                     consume(TokenType::Identifier); | ||||
| 
 | ||||
|                     auto alias_position = position(); | ||||
|                     auto alias = consume_identifier().flystring_value(); | ||||
|                     auto alias = consume_identifier().DeprecatedFlyString_value(); | ||||
|                     check_identifier_name_for_assignment_validity(alias); | ||||
| 
 | ||||
|                     entries_with_location.append({ { name, alias }, alias_position }); | ||||
|  | @ -4264,7 +4264,7 @@ NonnullRefPtr<ImportStatement> Parser::parse_import_statement(Program& program) | |||
|                 consume(TokenType::Identifier); | ||||
| 
 | ||||
|                 auto alias_position = position(); | ||||
|                 auto alias = consume_identifier().flystring_value(); | ||||
|                 auto alias = consume_identifier().DeprecatedFlyString_value(); | ||||
|                 check_identifier_name_for_assignment_validity(alias); | ||||
| 
 | ||||
|                 entries_with_location.append({ { move(name), alias }, alias_position }); | ||||
|  | @ -4351,7 +4351,7 @@ NonnullRefPtr<ExportStatement> Parser::parse_export_statement(Program& program) | |||
|         auto default_position = position(); | ||||
|         consume(TokenType::Default); | ||||
| 
 | ||||
|         FlyString local_name; | ||||
|         DeprecatedFlyString local_name; | ||||
| 
 | ||||
|         auto lookahead_token = next_token(); | ||||
| 
 | ||||
|  | @ -4466,7 +4466,7 @@ NonnullRefPtr<ExportStatement> Parser::parse_export_statement(Program& program) | |||
|             Required | ||||
|         } check_for_from { FromSpecifier::NotAllowed }; | ||||
| 
 | ||||
|         auto parse_module_export_name = [&](bool lhs) -> FlyString { | ||||
|         auto parse_module_export_name = [&](bool lhs) -> DeprecatedFlyString { | ||||
|             // https://tc39.es/ecma262/#prod-ModuleExportName
 | ||||
|             //  ModuleExportName :
 | ||||
|             //      IdentifierName
 | ||||
|  |  | |||
|  | @ -234,7 +234,7 @@ private: | |||
| 
 | ||||
|     Token next_token(size_t steps = 1) const; | ||||
| 
 | ||||
|     void check_identifier_name_for_assignment_validity(FlyString const&, bool force_strict = false); | ||||
|     void check_identifier_name_for_assignment_validity(DeprecatedFlyString const&, bool force_strict = false); | ||||
| 
 | ||||
|     bool try_parse_arrow_function_expression_failed_at_position(Position const&) const; | ||||
|     void set_try_parse_arrow_function_expression_failed_at_position(Position const&, bool); | ||||
|  | @ -244,7 +244,7 @@ private: | |||
|     bool parse_directive(ScopeNode& body); | ||||
|     void parse_statement_list(ScopeNode& output_node, AllowLabelledFunction allow_labelled_functions = AllowLabelledFunction::No); | ||||
| 
 | ||||
|     FlyString consume_string_value(); | ||||
|     DeprecatedFlyString consume_string_value(); | ||||
|     ModuleRequest parse_module_request(); | ||||
| 
 | ||||
|     struct RulePosition { | ||||
|  | @ -320,7 +320,7 @@ private: | |||
|     NonnullRefPtr<SourceCode> m_source_code; | ||||
|     Vector<Position> m_rule_starts; | ||||
|     ParserState m_state; | ||||
|     FlyString m_filename; | ||||
|     DeprecatedFlyString m_filename; | ||||
|     Vector<ParserState> m_saved_state; | ||||
|     HashMap<Position, TokenMemoization, PositionKeyTraits> m_token_memoizations; | ||||
|     Program::Type m_program_type; | ||||
|  |  | |||
|  | @ -102,7 +102,7 @@ ErrorOr<void> js_out(JS::PrintContext& print_context, CheckedFormatString<Args.. | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ErrorOr<void> print_type(JS::PrintContext& print_context, FlyString const& name) | ||||
| ErrorOr<void> print_type(JS::PrintContext& print_context, DeprecatedFlyString const& name) | ||||
| { | ||||
|     return js_out(print_context, "[\033[36;1m{}\033[0m]", name); | ||||
| } | ||||
|  |  | |||
|  | @ -201,7 +201,7 @@ ThrowCompletionOr<Realm*> get_function_realm(VM& vm, FunctionObject const& funct | |||
| } | ||||
| 
 | ||||
| // 8.5.2.1 InitializeBoundName ( name, value, environment ), https://tc39.es/ecma262/#sec-initializeboundname
 | ||||
| ThrowCompletionOr<void> initialize_bound_name(VM& vm, FlyString const& name, Value value, Environment* environment) | ||||
| ThrowCompletionOr<void> initialize_bound_name(VM& vm, DeprecatedFlyString const& name, Value value, Environment* environment) | ||||
| { | ||||
|     // 1. If environment is not undefined, then
 | ||||
|     if (environment) { | ||||
|  | @ -794,7 +794,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, Program const& pr | |||
|     Vector<FunctionDeclaration const&> functions_to_initialize; | ||||
| 
 | ||||
|     // 9. Let declaredFunctionNames be a new empty List.
 | ||||
|     HashTable<FlyString> declared_function_names; | ||||
|     HashTable<DeprecatedFlyString> declared_function_names; | ||||
| 
 | ||||
|     // 10. For each element d of varDeclarations, in reverse List order, do
 | ||||
|     TRY(program.for_each_var_function_declaration_in_reverse_order([&](FunctionDeclaration const& function) -> ThrowCompletionOr<void> { | ||||
|  | @ -835,7 +835,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, Program const& pr | |||
|     if (!strict) { | ||||
|         // a. Let declaredFunctionOrVarNames be the list-concatenation of declaredFunctionNames and declaredVarNames.
 | ||||
|         // The spec here uses 'declaredVarNames' but that has not been declared yet.
 | ||||
|         HashTable<FlyString> hoisted_functions; | ||||
|         HashTable<DeprecatedFlyString> hoisted_functions; | ||||
| 
 | ||||
|         // b. For each FunctionDeclaration f that is directly contained in the StatementList of a Block, CaseClause, or DefaultClause Contained within body, do
 | ||||
|         TRY(program.for_each_function_hoistable_with_annexB_extension([&](FunctionDeclaration& function_declaration) -> ThrowCompletionOr<void> { | ||||
|  | @ -926,7 +926,7 @@ ThrowCompletionOr<void> eval_declaration_instantiation(VM& vm, Program const& pr | |||
|     } | ||||
| 
 | ||||
|     // 12. Let declaredVarNames be a new empty List.
 | ||||
|     HashTable<FlyString> declared_var_names; | ||||
|     HashTable<DeprecatedFlyString> declared_var_names; | ||||
| 
 | ||||
|     // 13. For each element d of varDeclarations, do
 | ||||
|     TRY(program.for_each_var_scoped_variable_declaration([&](VariableDeclaration const& declaration) { | ||||
|  | @ -1119,14 +1119,14 @@ Object* create_mapped_arguments_object(VM& vm, FunctionObject& function, Vector< | |||
|     MUST(object->define_property_or_throw(vm.names.length, { .value = Value(length), .writable = true, .enumerable = false, .configurable = true })); | ||||
| 
 | ||||
|     // 17. Let mappedNames be a new empty List.
 | ||||
|     HashTable<FlyString> mapped_names; | ||||
|     HashTable<DeprecatedFlyString> mapped_names; | ||||
| 
 | ||||
|     // 18. Set index to numberOfParameters - 1.
 | ||||
|     // 19. Repeat, while index ≥ 0,
 | ||||
|     VERIFY(formals.size() <= NumericLimits<i32>::max()); | ||||
|     for (i32 index = static_cast<i32>(formals.size()) - 1; index >= 0; --index) { | ||||
|         // a. Let name be parameterNames[index].
 | ||||
|         auto const& name = formals[index].binding.get<FlyString>(); | ||||
|         auto const& name = formals[index].binding.get<DeprecatedFlyString>(); | ||||
| 
 | ||||
|         // b. If name is not an element of mappedNames, then
 | ||||
|         if (mapped_names.contains(name)) | ||||
|  |  | |||
|  | @ -35,7 +35,7 @@ ThrowCompletionOr<size_t> length_of_array_like(VM&, Object const&); | |||
| ThrowCompletionOr<MarkedVector<Value>> create_list_from_array_like(VM&, Value, Function<ThrowCompletionOr<void>(Value)> = {}); | ||||
| ThrowCompletionOr<FunctionObject*> species_constructor(VM&, Object const&, FunctionObject& default_constructor); | ||||
| ThrowCompletionOr<Realm*> get_function_realm(VM&, FunctionObject const&); | ||||
| ThrowCompletionOr<void> initialize_bound_name(VM&, FlyString const&, Value, Environment*); | ||||
| ThrowCompletionOr<void> initialize_bound_name(VM&, DeprecatedFlyString const&, Value, Environment*); | ||||
| bool is_compatible_property_descriptor(bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current); | ||||
| bool validate_and_apply_property_descriptor(Object*, PropertyKey const&, bool extensible, PropertyDescriptor const&, Optional<PropertyDescriptor> const& current); | ||||
| ThrowCompletionOr<Object*> get_prototype_from_constructor(VM&, FunctionObject const& constructor, Object* (Intrinsics::*intrinsic_default_prototype)()); | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ public: | |||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|     virtual ThrowCompletionOr<NonnullGCPtr<Object>> internal_construct(MarkedVector<Value> arguments_list, FunctionObject& new_target) override; | ||||
| 
 | ||||
|     virtual FlyString const& name() const override { return m_name; } | ||||
|     virtual DeprecatedFlyString const& name() const override { return m_name; } | ||||
|     virtual bool is_strict_mode() const override { return m_bound_target_function->is_strict_mode(); } | ||||
|     virtual bool has_constructor() const override { return m_bound_target_function->has_constructor(); } | ||||
| 
 | ||||
|  | @ -39,7 +39,7 @@ private: | |||
|     Value m_bound_this;                                  // [[BoundThis]]
 | ||||
|     Vector<Value> m_bound_arguments;                     // [[BoundArguments]]
 | ||||
| 
 | ||||
|     FlyString m_name; | ||||
|     DeprecatedFlyString m_name; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Runtime/PropertyKey.h> | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Optional.h> | ||||
| #include <AK/Try.h> | ||||
| #include <AK/Variant.h> | ||||
|  | @ -40,7 +40,7 @@ public: | |||
|         Throw, | ||||
|     }; | ||||
| 
 | ||||
|     ALWAYS_INLINE Completion(Type type, Optional<Value> value, Optional<FlyString> target) | ||||
|     ALWAYS_INLINE Completion(Type type, Optional<Value> value, Optional<DeprecatedFlyString> target) | ||||
|         : m_type(type) | ||||
|         , m_value(move(value)) | ||||
|         , m_target(move(target)) | ||||
|  | @ -81,8 +81,8 @@ public: | |||
|     } | ||||
|     [[nodiscard]] Optional<Value>& value() { return m_value; } | ||||
|     [[nodiscard]] Optional<Value> const& value() const { return m_value; } | ||||
|     [[nodiscard]] Optional<FlyString>& target() { return m_target; } | ||||
|     [[nodiscard]] Optional<FlyString> const& target() const { return m_target; } | ||||
|     [[nodiscard]] Optional<DeprecatedFlyString>& target() { return m_target; } | ||||
|     [[nodiscard]] Optional<DeprecatedFlyString> const& target() const { return m_target; } | ||||
| 
 | ||||
|     // "abrupt completion refers to any completion with a [[Type]] value other than normal"
 | ||||
|     [[nodiscard]] bool is_abrupt() const { return m_type != Type::Normal; } | ||||
|  | @ -129,7 +129,7 @@ private: | |||
| 
 | ||||
|     Type m_type { Type::Normal };           // [[Type]]
 | ||||
|     Optional<Value> m_value;                // [[Value]]
 | ||||
|     Optional<FlyString> m_target; // [[Target]]
 | ||||
|     Optional<DeprecatedFlyString> m_target; // [[Target]]
 | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -45,7 +45,7 @@ void DeclarativeEnvironment::visit_edges(Visitor& visitor) | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.1 HasBinding ( N ), https://tc39.es/ecma262/#sec-declarative-environment-records-hasbinding-n
 | ||||
| ThrowCompletionOr<bool> DeclarativeEnvironment::has_binding(FlyString const& name, Optional<size_t>* out_index) const | ||||
| ThrowCompletionOr<bool> DeclarativeEnvironment::has_binding(DeprecatedFlyString const& name, Optional<size_t>* out_index) const | ||||
| { | ||||
|     auto binding_and_index = find_binding_and_index(name); | ||||
|     if (!binding_and_index.has_value()) | ||||
|  | @ -56,7 +56,7 @@ ThrowCompletionOr<bool> DeclarativeEnvironment::has_binding(FlyString const& nam | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.2 CreateMutableBinding ( N, D ), https://tc39.es/ecma262/#sec-declarative-environment-records-createmutablebinding-n-d
 | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::create_mutable_binding(VM&, FlyString const& name, bool can_be_deleted) | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::create_mutable_binding(VM&, DeprecatedFlyString const& name, bool can_be_deleted) | ||||
| { | ||||
|     // 1. Assert: envRec does not already have a binding for N.
 | ||||
|     // NOTE: We skip this to avoid O(n) traversal of m_bindings.
 | ||||
|  | @ -76,7 +76,7 @@ ThrowCompletionOr<void> DeclarativeEnvironment::create_mutable_binding(VM&, FlyS | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.3 CreateImmutableBinding ( N, S ), https://tc39.es/ecma262/#sec-declarative-environment-records-createimmutablebinding-n-s
 | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::create_immutable_binding(VM&, FlyString const& name, bool strict) | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::create_immutable_binding(VM&, DeprecatedFlyString const& name, bool strict) | ||||
| { | ||||
|     // 1. Assert: envRec does not already have a binding for N.
 | ||||
|     // NOTE: We skip this to avoid O(n) traversal of m_bindings.
 | ||||
|  | @ -96,7 +96,7 @@ ThrowCompletionOr<void> DeclarativeEnvironment::create_immutable_binding(VM&, Fl | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.4 InitializeBinding ( N, V ), https://tc39.es/ecma262/#sec-declarative-environment-records-initializebinding-n-v
 | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::initialize_binding(VM& vm, FlyString const& name, Value value) | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::initialize_binding(VM& vm, DeprecatedFlyString const& name, Value value) | ||||
| { | ||||
|     auto binding_and_index = find_binding_and_index(name); | ||||
|     VERIFY(binding_and_index.has_value()); | ||||
|  | @ -120,7 +120,7 @@ ThrowCompletionOr<void> DeclarativeEnvironment::initialize_binding_direct(VM&, B | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.5 SetMutableBinding ( N, V, S ), https://tc39.es/ecma262/#sec-declarative-environment-records-setmutablebinding-n-v-s
 | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::set_mutable_binding(VM& vm, FlyString const& name, Value value, bool strict) | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::set_mutable_binding(VM& vm, DeprecatedFlyString const& name, Value value, bool strict) | ||||
| { | ||||
|     // 1. If envRec does not have a binding for N, then
 | ||||
|     auto binding_and_index = find_binding_and_index(name); | ||||
|  | @ -170,7 +170,7 @@ ThrowCompletionOr<void> DeclarativeEnvironment::set_mutable_binding_direct(VM& v | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.6 GetBindingValue ( N, S ), https://tc39.es/ecma262/#sec-declarative-environment-records-getbindingvalue-n-s
 | ||||
| ThrowCompletionOr<Value> DeclarativeEnvironment::get_binding_value(VM& vm, FlyString const& name, bool strict) | ||||
| ThrowCompletionOr<Value> DeclarativeEnvironment::get_binding_value(VM& vm, DeprecatedFlyString const& name, bool strict) | ||||
| { | ||||
|     // 1. Assert: envRec has a binding for N.
 | ||||
|     auto binding_and_index = find_binding_and_index(name); | ||||
|  | @ -196,7 +196,7 @@ ThrowCompletionOr<Value> DeclarativeEnvironment::get_binding_value_direct(VM&, B | |||
| } | ||||
| 
 | ||||
| // 9.1.1.1.7 DeleteBinding ( N ), https://tc39.es/ecma262/#sec-declarative-environment-records-deletebinding-n
 | ||||
| ThrowCompletionOr<bool> DeclarativeEnvironment::delete_binding(VM&, FlyString const& name) | ||||
| ThrowCompletionOr<bool> DeclarativeEnvironment::delete_binding(VM&, DeprecatedFlyString const& name) | ||||
| { | ||||
|     // 1. Assert: envRec has a binding for the name that is the value of N.
 | ||||
|     auto binding_and_index = find_binding_and_index(name); | ||||
|  | @ -214,7 +214,7 @@ ThrowCompletionOr<bool> DeclarativeEnvironment::delete_binding(VM&, FlyString co | |||
|     return true; | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::initialize_or_set_mutable_binding(VM& vm, FlyString const& name, Value value) | ||||
| ThrowCompletionOr<void> DeclarativeEnvironment::initialize_or_set_mutable_binding(VM& vm, DeprecatedFlyString const& name, Value value) | ||||
| { | ||||
|     auto binding_and_index = find_binding_and_index(name); | ||||
|     VERIFY(binding_and_index.has_value()); | ||||
|  | @ -226,7 +226,7 @@ ThrowCompletionOr<void> DeclarativeEnvironment::initialize_or_set_mutable_bindin | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| void DeclarativeEnvironment::initialize_or_set_mutable_binding(Badge<ScopeNode>, VM& vm, FlyString const& name, Value value) | ||||
| void DeclarativeEnvironment::initialize_or_set_mutable_binding(Badge<ScopeNode>, VM& vm, DeprecatedFlyString const& name, Value value) | ||||
| { | ||||
|     MUST(initialize_or_set_mutable_binding(vm, name, value)); | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/HashMap.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/Environment.h> | ||||
|  | @ -18,7 +18,7 @@ class DeclarativeEnvironment : public Environment { | |||
|     JS_ENVIRONMENT(DeclarativeEnvironment, Environment); | ||||
| 
 | ||||
|     struct Binding { | ||||
|         FlyString name; | ||||
|         DeprecatedFlyString name; | ||||
|         Value value; | ||||
|         bool strict { false }; | ||||
|         bool mutable_ { false }; | ||||
|  | @ -31,21 +31,21 @@ public: | |||
| 
 | ||||
|     virtual ~DeclarativeEnvironment() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<bool> has_binding(FlyString const& name, Optional<size_t>* = nullptr) const override; | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, FlyString const& name, bool can_be_deleted) override; | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, FlyString const& name, Value) override; | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, FlyString const& name, Value, bool strict) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, FlyString const& name) override; | ||||
|     virtual ThrowCompletionOr<bool> has_binding(DeprecatedFlyString const& name, Optional<size_t>* = nullptr) const override; | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, DeprecatedFlyString const& name, bool can_be_deleted) override; | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, DeprecatedFlyString const& name, Value) override; | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, DeprecatedFlyString const& name, Value, bool strict) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, DeprecatedFlyString const& name) override; | ||||
| 
 | ||||
|     void initialize_or_set_mutable_binding(Badge<ScopeNode>, VM&, FlyString const& name, Value value); | ||||
|     ThrowCompletionOr<void> initialize_or_set_mutable_binding(VM&, FlyString const& name, Value value); | ||||
|     void initialize_or_set_mutable_binding(Badge<ScopeNode>, VM&, DeprecatedFlyString const& name, Value value); | ||||
|     ThrowCompletionOr<void> initialize_or_set_mutable_binding(VM&, DeprecatedFlyString const& name, Value value); | ||||
| 
 | ||||
|     // This is not a method defined in the spec! Do not use this in any LibJS (or other spec related) code.
 | ||||
|     [[nodiscard]] Vector<FlyString> bindings() const | ||||
|     [[nodiscard]] Vector<DeprecatedFlyString> bindings() const | ||||
|     { | ||||
|         Vector<FlyString> names; | ||||
|         Vector<DeprecatedFlyString> names; | ||||
|         names.ensure_capacity(m_bindings.size()); | ||||
| 
 | ||||
|         for (auto const& binding : m_bindings) | ||||
|  | @ -101,7 +101,7 @@ protected: | |||
| 
 | ||||
|     friend class ModuleEnvironment; | ||||
| 
 | ||||
|     virtual Optional<BindingAndIndex> find_binding_and_index(FlyString const& name) const | ||||
|     virtual Optional<BindingAndIndex> find_binding_and_index(DeprecatedFlyString const& name) const | ||||
|     { | ||||
|         auto it = m_bindings.find_if([&](auto const& binding) { | ||||
|             return binding.name == name; | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& realm, FlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind kind, 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) | ||||
| NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& realm, DeprecatedFlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind kind, 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) | ||||
| { | ||||
|     Object* prototype = nullptr; | ||||
|     switch (kind) { | ||||
|  | @ -48,12 +48,12 @@ NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& r | |||
|     return realm.heap().allocate<ECMAScriptFunctionObject>(realm, move(name), move(source_text), ecmascript_code, move(parameters), m_function_length, parent_environment, private_environment, *prototype, kind, is_strict, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function, move(class_field_initializer_name)); | ||||
| } | ||||
| 
 | ||||
| NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& realm, FlyString name, Object& prototype, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind kind, 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) | ||||
| NonnullGCPtr<ECMAScriptFunctionObject> ECMAScriptFunctionObject::create(Realm& realm, DeprecatedFlyString name, Object& prototype, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> parameters, i32 m_function_length, Environment* parent_environment, PrivateEnvironment* private_environment, FunctionKind kind, 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) | ||||
| { | ||||
|     return realm.heap().allocate<ECMAScriptFunctionObject>(realm, move(name), move(source_text), ecmascript_code, move(parameters), m_function_length, parent_environment, private_environment, prototype, kind, is_strict, might_need_arguments_object, contains_direct_call_to_eval, is_arrow_function, move(class_field_initializer_name)); | ||||
| } | ||||
| 
 | ||||
| ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> formal_parameters, i32 function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind kind, bool strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name) | ||||
| ECMAScriptFunctionObject::ECMAScriptFunctionObject(DeprecatedFlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> formal_parameters, i32 function_length, Environment* parent_environment, PrivateEnvironment* private_environment, Object& prototype, FunctionKind kind, bool strict, bool might_need_arguments_object, bool contains_direct_call_to_eval, bool is_arrow_function, Variant<PropertyKey, PrivateName, Empty> class_field_initializer_name) | ||||
|     : FunctionObject(prototype) | ||||
|     , m_name(move(name)) | ||||
|     , m_function_length(function_length) | ||||
|  | @ -91,7 +91,7 @@ ECMAScriptFunctionObject::ECMAScriptFunctionObject(FlyString name, DeprecatedStr | |||
|             return false; | ||||
|         if (parameter.default_value) | ||||
|             return false; | ||||
|         if (!parameter.binding.template has<FlyString>()) | ||||
|         if (!parameter.binding.template has<DeprecatedFlyString>()) | ||||
|             return false; | ||||
|         return true; | ||||
|     }); | ||||
|  | @ -338,13 +338,13 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia | |||
|     // FIXME: Maybe compute has duplicates at parse time? (We need to anyway since it's an error in some cases)
 | ||||
| 
 | ||||
|     bool has_duplicates = false; | ||||
|     HashTable<FlyString> parameter_names; | ||||
|     HashTable<DeprecatedFlyString> parameter_names; | ||||
|     for (auto& parameter : m_formal_parameters) { | ||||
|         if (parameter.default_value) | ||||
|             has_parameter_expressions = true; | ||||
| 
 | ||||
|         parameter.binding.visit( | ||||
|             [&](FlyString const& name) { | ||||
|             [&](DeprecatedFlyString const& name) { | ||||
|                 if (parameter_names.set(name) != AK::HashSetResult::InsertedNewEntry) | ||||
|                     has_duplicates = true; | ||||
|             }, | ||||
|  | @ -367,7 +367,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia | |||
|     if (parameter_names.contains(vm.names.arguments.as_string())) | ||||
|         arguments_object_needed = false; | ||||
| 
 | ||||
|     HashTable<FlyString> function_names; | ||||
|     HashTable<DeprecatedFlyString> function_names; | ||||
|     Vector<FunctionDeclaration const&> functions_to_initialize; | ||||
| 
 | ||||
|     if (scope_body) { | ||||
|  | @ -463,7 +463,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia | |||
| 
 | ||||
|                 Environment* used_environment = has_duplicates ? nullptr : environment; | ||||
| 
 | ||||
|                 if constexpr (IsSame<FlyString const&, decltype(param)>) { | ||||
|                 if constexpr (IsSame<DeprecatedFlyString const&, decltype(param)>) { | ||||
|                     Reference reference = TRY(vm.resolve_binding(param, used_environment)); | ||||
|                     // Here the difference from hasDuplicates is important
 | ||||
|                     if (has_duplicates) | ||||
|  | @ -479,7 +479,7 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia | |||
| 
 | ||||
|     GCPtr<Environment> var_environment; | ||||
| 
 | ||||
|     HashTable<FlyString> instantiated_var_names; | ||||
|     HashTable<DeprecatedFlyString> instantiated_var_names; | ||||
|     if (scope_body) | ||||
|         instantiated_var_names.ensure_capacity(scope_body->var_declaration_count()); | ||||
| 
 | ||||
|  | @ -911,7 +911,7 @@ Completion ECMAScriptFunctionObject::ordinary_call_evaluate_body() | |||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| void ECMAScriptFunctionObject::set_name(FlyString const& name) | ||||
| void ECMAScriptFunctionObject::set_name(DeprecatedFlyString const& name) | ||||
| { | ||||
|     VERIFY(!name.is_null()); | ||||
|     auto& vm = this->vm(); | ||||
|  |  | |||
|  | @ -32,8 +32,8 @@ public: | |||
|         Global, | ||||
|     }; | ||||
| 
 | ||||
|     static NonnullGCPtr<ECMAScriptFunctionObject> create(Realm&, FlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> 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 NonnullGCPtr<ECMAScriptFunctionObject> create(Realm&, FlyString name, Object& prototype, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> 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 NonnullGCPtr<ECMAScriptFunctionObject> create(Realm&, DeprecatedFlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> 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 NonnullGCPtr<ECMAScriptFunctionObject> create(Realm&, DeprecatedFlyString name, Object& prototype, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> 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 = {}); | ||||
| 
 | ||||
|     virtual void initialize(Realm&) override; | ||||
|     virtual ~ECMAScriptFunctionObject() override = default; | ||||
|  | @ -46,8 +46,8 @@ public: | |||
|     Statement const& ecmascript_code() const { return m_ecmascript_code; } | ||||
|     Vector<FunctionParameter> const& formal_parameters() const { return m_formal_parameters; }; | ||||
| 
 | ||||
|     virtual FlyString const& name() const override { return m_name; }; | ||||
|     void set_name(FlyString const& name); | ||||
|     virtual DeprecatedFlyString const& name() const override { return m_name; }; | ||||
|     void set_name(DeprecatedFlyString const& name); | ||||
| 
 | ||||
|     void set_is_class_constructor() { m_is_class_constructor = true; }; | ||||
| 
 | ||||
|  | @ -93,7 +93,7 @@ protected: | |||
|     virtual Completion ordinary_call_evaluate_body(); | ||||
| 
 | ||||
| private: | ||||
|     ECMAScriptFunctionObject(FlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> 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); | ||||
|     ECMAScriptFunctionObject(DeprecatedFlyString name, DeprecatedString source_text, Statement const& ecmascript_code, Vector<FunctionParameter> 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; | ||||
|  | @ -105,7 +105,7 @@ private: | |||
| 
 | ||||
|     ThrowCompletionOr<void> function_declaration_instantiation(Interpreter*); | ||||
| 
 | ||||
|     FlyString m_name; | ||||
|     DeprecatedFlyString m_name; | ||||
|     OwnPtr<Bytecode::Executable> m_bytecode_executable; | ||||
|     Vector<OwnPtr<Bytecode::Executable>> m_default_parameter_bytecode_executables; | ||||
|     i32 m_function_length { 0 }; | ||||
|  |  | |||
|  | @ -28,13 +28,13 @@ public: | |||
| 
 | ||||
|     virtual Object* with_base_object() const { return nullptr; } | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<bool> has_binding([[maybe_unused]] FlyString const& name, [[maybe_unused]] Optional<size_t>* out_index = nullptr) const { return false; } | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, [[maybe_unused]] FlyString const& name, [[maybe_unused]] bool can_be_deleted) { return {}; } | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, [[maybe_unused]] FlyString const& name, [[maybe_unused]] bool strict) { return {}; } | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, [[maybe_unused]] FlyString const& name, Value) { return {}; } | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, [[maybe_unused]] FlyString const& name, Value, [[maybe_unused]] bool strict) { return {}; } | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, [[maybe_unused]] FlyString const& name, [[maybe_unused]] bool strict) { return Value {}; } | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, [[maybe_unused]] FlyString const& name) { return false; } | ||||
|     virtual ThrowCompletionOr<bool> has_binding([[maybe_unused]] DeprecatedFlyString const& name, [[maybe_unused]] Optional<size_t>* out_index = nullptr) const { return false; } | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, [[maybe_unused]] DeprecatedFlyString const& name, [[maybe_unused]] bool can_be_deleted) { return {}; } | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, [[maybe_unused]] DeprecatedFlyString const& name, [[maybe_unused]] bool strict) { return {}; } | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, [[maybe_unused]] DeprecatedFlyString const& name, Value) { return {}; } | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, [[maybe_unused]] DeprecatedFlyString const& name, Value, [[maybe_unused]] bool strict) { return {}; } | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, [[maybe_unused]] DeprecatedFlyString const& name, [[maybe_unused]] bool strict) { return Value {}; } | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, [[maybe_unused]] DeprecatedFlyString const& name) { return false; } | ||||
| 
 | ||||
|     // [[OuterEnv]]
 | ||||
|     Environment* outer_environment() { return m_outer_environment; } | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/Object.h> | ||||
| #include <LibJS/SourceRange.h> | ||||
|  | @ -15,7 +15,7 @@ | |||
| namespace JS { | ||||
| 
 | ||||
| struct TracebackFrame { | ||||
|     FlyString function_name; | ||||
|     DeprecatedFlyString function_name; | ||||
|     SourceRange source_range; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/WeakPtr.h> | ||||
| #include <LibJS/Forward.h> | ||||
| #include <LibJS/Heap/MarkedVector.h> | ||||
|  | @ -43,7 +43,7 @@ public: | |||
|     Cell* context_owner { nullptr }; | ||||
| 
 | ||||
|     ASTNode const* current_node { nullptr }; | ||||
|     FlyString function_name; | ||||
|     DeprecatedFlyString function_name; | ||||
|     Value this_value; | ||||
|     MarkedVector<Value> arguments; | ||||
|     bool is_strict_mode { false }; | ||||
|  |  | |||
|  | @ -27,7 +27,7 @@ public: | |||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) = 0; | ||||
|     virtual ThrowCompletionOr<NonnullGCPtr<Object>> internal_construct([[maybe_unused]] MarkedVector<Value> arguments_list, [[maybe_unused]] FunctionObject& new_target) { VERIFY_NOT_REACHED(); } | ||||
| 
 | ||||
|     virtual FlyString const& name() const = 0; | ||||
|     virtual DeprecatedFlyString const& name() const = 0; | ||||
| 
 | ||||
|     void set_function_name(Variant<PropertyKey, PrivateName> const& name_arg, Optional<StringView> const& prefix = {}); | ||||
|     void set_function_length(double length); | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ public: | |||
|     virtual ~FunctionPrototype() override = default; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
|     virtual FlyString const& name() const override { return m_name; } | ||||
|     virtual DeprecatedFlyString const& name() const override { return m_name; } | ||||
| 
 | ||||
| private: | ||||
|     explicit FunctionPrototype(Realm&); | ||||
|  | @ -31,7 +31,7 @@ private: | |||
| 
 | ||||
|     // Totally unnecessary, but sadly still necessary.
 | ||||
|     // TODO: Get rid of the pointless name() method.
 | ||||
|     FlyString m_name { "FunctionPrototype" }; | ||||
|     DeprecatedFlyString m_name { "FunctionPrototype" }; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ ThrowCompletionOr<Value> GlobalEnvironment::get_this_binding(VM&) const | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.1 HasBinding ( N ), https://tc39.es/ecma262/#sec-global-environment-records-hasbinding-n
 | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::has_binding(FlyString const& name, Optional<size_t>* out_index) const | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::has_binding(DeprecatedFlyString const& name, Optional<size_t>* out_index) const | ||||
| { | ||||
|     if (out_index) | ||||
|         *out_index = EnvironmentCoordinate::global_marker; | ||||
|  | @ -55,7 +55,7 @@ ThrowCompletionOr<bool> GlobalEnvironment::has_binding(FlyString const& name, Op | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.2 CreateMutableBinding ( N, D ), https://tc39.es/ecma262/#sec-global-environment-records-createmutablebinding-n-d
 | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_mutable_binding(VM& vm, FlyString const& name, bool can_be_deleted) | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_mutable_binding(VM& vm, DeprecatedFlyString const& name, bool can_be_deleted) | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. If ! DclRec.HasBinding(N) is true, throw a TypeError exception.
 | ||||
|  | @ -67,7 +67,7 @@ ThrowCompletionOr<void> GlobalEnvironment::create_mutable_binding(VM& vm, FlyStr | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.3 CreateImmutableBinding ( N, S ), https://tc39.es/ecma262/#sec-global-environment-records-createimmutablebinding-n-s
 | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_immutable_binding(VM& vm, FlyString const& name, bool strict) | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_immutable_binding(VM& vm, DeprecatedFlyString const& name, bool strict) | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. If ! DclRec.HasBinding(N) is true, throw a TypeError exception.
 | ||||
|  | @ -79,7 +79,7 @@ ThrowCompletionOr<void> GlobalEnvironment::create_immutable_binding(VM& vm, FlyS | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.4 InitializeBinding ( N, V ), https://tc39.es/ecma262/#sec-global-environment-records-initializebinding-n-v
 | ||||
| ThrowCompletionOr<void> GlobalEnvironment::initialize_binding(VM& vm, FlyString const& name, Value value) | ||||
| ThrowCompletionOr<void> GlobalEnvironment::initialize_binding(VM& vm, DeprecatedFlyString const& name, Value value) | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. If ! DclRec.HasBinding(N) is true, then
 | ||||
|  | @ -95,7 +95,7 @@ ThrowCompletionOr<void> GlobalEnvironment::initialize_binding(VM& vm, FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.5 SetMutableBinding ( N, V, S ), https://tc39.es/ecma262/#sec-global-environment-records-setmutablebinding-n-v-s
 | ||||
| ThrowCompletionOr<void> GlobalEnvironment::set_mutable_binding(VM& vm, FlyString const& name, Value value, bool strict) | ||||
| ThrowCompletionOr<void> GlobalEnvironment::set_mutable_binding(VM& vm, DeprecatedFlyString const& name, Value value, bool strict) | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. If ! DclRec.HasBinding(N) is true, then
 | ||||
|  | @ -110,7 +110,7 @@ ThrowCompletionOr<void> GlobalEnvironment::set_mutable_binding(VM& vm, FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.6 GetBindingValue ( N, S ), https://tc39.es/ecma262/#sec-global-environment-records-getbindingvalue-n-s
 | ||||
| ThrowCompletionOr<Value> GlobalEnvironment::get_binding_value(VM& vm, FlyString const& name, bool strict) | ||||
| ThrowCompletionOr<Value> GlobalEnvironment::get_binding_value(VM& vm, DeprecatedFlyString const& name, bool strict) | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. If ! DclRec.HasBinding(N) is true, then
 | ||||
|  | @ -125,7 +125,7 @@ ThrowCompletionOr<Value> GlobalEnvironment::get_binding_value(VM& vm, FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.7 DeleteBinding ( N ), https://tc39.es/ecma262/#sec-global-environment-records-deletebinding-n
 | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::delete_binding(VM& vm, FlyString const& name) | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::delete_binding(VM& vm, DeprecatedFlyString const& name) | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. If ! DclRec.HasBinding(N) is true, then
 | ||||
|  | @ -161,7 +161,7 @@ ThrowCompletionOr<bool> GlobalEnvironment::delete_binding(VM& vm, FlyString cons | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.12 HasVarDeclaration ( N ), https://tc39.es/ecma262/#sec-hasvardeclaration
 | ||||
| bool GlobalEnvironment::has_var_declaration(FlyString const& name) const | ||||
| bool GlobalEnvironment::has_var_declaration(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     // 1. Let varDeclaredNames be envRec.[[VarNames]].
 | ||||
|     // 2. If varDeclaredNames contains N, return true.
 | ||||
|  | @ -170,7 +170,7 @@ bool GlobalEnvironment::has_var_declaration(FlyString const& name) const | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.13 HasLexicalDeclaration ( N ), https://tc39.es/ecma262/#sec-haslexicaldeclaration
 | ||||
| bool GlobalEnvironment::has_lexical_declaration(FlyString const& name) const | ||||
| bool GlobalEnvironment::has_lexical_declaration(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     // 1. Let DclRec be envRec.[[DeclarativeRecord]].
 | ||||
|     // 2. Return ! DclRec.HasBinding(N).
 | ||||
|  | @ -178,7 +178,7 @@ bool GlobalEnvironment::has_lexical_declaration(FlyString const& name) const | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.14 HasRestrictedGlobalProperty ( N ), https://tc39.es/ecma262/#sec-hasrestrictedglobalproperty
 | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::has_restricted_global_property(FlyString const& name) const | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::has_restricted_global_property(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     // 1. Let ObjRec be envRec.[[ObjectRecord]].
 | ||||
|     // 2. Let globalObject be ObjRec.[[BindingObject]].
 | ||||
|  | @ -200,7 +200,7 @@ ThrowCompletionOr<bool> GlobalEnvironment::has_restricted_global_property(FlyStr | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.15 CanDeclareGlobalVar ( N ), https://tc39.es/ecma262/#sec-candeclareglobalvar
 | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::can_declare_global_var(FlyString const& name) const | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::can_declare_global_var(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     // 1. Let ObjRec be envRec.[[ObjectRecord]].
 | ||||
|     // 2. Let globalObject be ObjRec.[[BindingObject]].
 | ||||
|  | @ -218,7 +218,7 @@ ThrowCompletionOr<bool> GlobalEnvironment::can_declare_global_var(FlyString cons | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.16 CanDeclareGlobalFunction ( N ), https://tc39.es/ecma262/#sec-candeclareglobalfunction
 | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::can_declare_global_function(FlyString const& name) const | ||||
| ThrowCompletionOr<bool> GlobalEnvironment::can_declare_global_function(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     // 1. Let ObjRec be envRec.[[ObjectRecord]].
 | ||||
|     // 2. Let globalObject be ObjRec.[[BindingObject]].
 | ||||
|  | @ -244,7 +244,7 @@ ThrowCompletionOr<bool> GlobalEnvironment::can_declare_global_function(FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.17 CreateGlobalVarBinding ( N, D ), https://tc39.es/ecma262/#sec-createglobalvarbinding
 | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_global_var_binding(FlyString const& name, bool can_be_deleted) | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_global_var_binding(DeprecatedFlyString const& name, bool can_be_deleted) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -279,7 +279,7 @@ ThrowCompletionOr<void> GlobalEnvironment::create_global_var_binding(FlyString c | |||
| } | ||||
| 
 | ||||
| // 9.1.1.4.18 CreateGlobalFunctionBinding ( N, V, D ), https://tc39.es/ecma262/#sec-createglobalfunctionbinding
 | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_global_function_binding(FlyString const& name, Value value, bool can_be_deleted) | ||||
| ThrowCompletionOr<void> GlobalEnvironment::create_global_function_binding(DeprecatedFlyString const& name, Value value, bool can_be_deleted) | ||||
| { | ||||
|     // 1. Let ObjRec be envRec.[[ObjectRecord]].
 | ||||
|     // 2. Let globalObject be ObjRec.[[BindingObject]].
 | ||||
|  |  | |||
|  | @ -17,25 +17,25 @@ public: | |||
|     virtual bool has_this_binding() const final { return true; } | ||||
|     virtual ThrowCompletionOr<Value> get_this_binding(VM&) const final; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<bool> has_binding(FlyString const& name, Optional<size_t>* = nullptr) const override; | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, FlyString const& name, bool can_be_deleted) override; | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, FlyString const& name, Value) override; | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, FlyString const& name, Value, bool strict) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, FlyString const& name) override; | ||||
|     virtual ThrowCompletionOr<bool> has_binding(DeprecatedFlyString const& name, Optional<size_t>* = nullptr) const override; | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, DeprecatedFlyString const& name, bool can_be_deleted) override; | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, DeprecatedFlyString const& name, Value) override; | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, DeprecatedFlyString const& name, Value, bool strict) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, DeprecatedFlyString const& name) override; | ||||
| 
 | ||||
|     ObjectEnvironment& object_record() { return *m_object_record; } | ||||
|     Object& global_this_value() { return *m_global_this_value; } | ||||
|     DeclarativeEnvironment& declarative_record() { return *m_declarative_record; } | ||||
| 
 | ||||
|     bool has_var_declaration(FlyString const& name) const; | ||||
|     bool has_lexical_declaration(FlyString const& name) const; | ||||
|     ThrowCompletionOr<bool> has_restricted_global_property(FlyString const& name) const; | ||||
|     ThrowCompletionOr<bool> can_declare_global_var(FlyString const& name) const; | ||||
|     ThrowCompletionOr<bool> can_declare_global_function(FlyString const& name) const; | ||||
|     ThrowCompletionOr<void> create_global_var_binding(FlyString const& name, bool can_be_deleted); | ||||
|     ThrowCompletionOr<void> create_global_function_binding(FlyString const& name, Value, bool can_be_deleted); | ||||
|     bool has_var_declaration(DeprecatedFlyString const& name) const; | ||||
|     bool has_lexical_declaration(DeprecatedFlyString const& name) const; | ||||
|     ThrowCompletionOr<bool> has_restricted_global_property(DeprecatedFlyString const& name) const; | ||||
|     ThrowCompletionOr<bool> can_declare_global_var(DeprecatedFlyString const& name) const; | ||||
|     ThrowCompletionOr<bool> can_declare_global_function(DeprecatedFlyString const& name) const; | ||||
|     ThrowCompletionOr<void> create_global_var_binding(DeprecatedFlyString const& name, bool can_be_deleted); | ||||
|     ThrowCompletionOr<void> create_global_function_binding(DeprecatedFlyString const& name, Value, bool can_be_deleted); | ||||
| 
 | ||||
| private: | ||||
|     GlobalEnvironment(Object&, Object& this_value); | ||||
|  | @ -46,7 +46,7 @@ private: | |||
|     ObjectEnvironment* m_object_record { nullptr };           // [[ObjectRecord]]
 | ||||
|     Object* m_global_this_value { nullptr };                  // [[GlobalThisValue]]
 | ||||
|     DeclarativeEnvironment* m_declarative_record { nullptr }; // [[DeclarativeRecord]]
 | ||||
|     Vector<FlyString> m_var_names;                            // [[VarNames]]
 | ||||
|     Vector<DeprecatedFlyString> m_var_names;                  // [[VarNames]]
 | ||||
| }; | ||||
| 
 | ||||
| template<> | ||||
|  |  | |||
|  | @ -18,7 +18,7 @@ ModuleEnvironment::ModuleEnvironment(Environment* outer_environment) | |||
| } | ||||
| 
 | ||||
| // 9.1.1.5.1 GetBindingValue ( N, S ), https://tc39.es/ecma262/#sec-module-environment-records-getbindingvalue-n-s
 | ||||
| ThrowCompletionOr<Value> ModuleEnvironment::get_binding_value(VM& vm, FlyString const& name, bool strict) | ||||
| ThrowCompletionOr<Value> ModuleEnvironment::get_binding_value(VM& vm, DeprecatedFlyString const& name, bool strict) | ||||
| { | ||||
|     // 1. Assert: S is true.
 | ||||
|     VERIFY(strict); | ||||
|  | @ -49,7 +49,7 @@ ThrowCompletionOr<Value> ModuleEnvironment::get_binding_value(VM& vm, FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.5.2 DeleteBinding ( N ), https://tc39.es/ecma262/#sec-module-environment-records-deletebinding-n
 | ||||
| ThrowCompletionOr<bool> ModuleEnvironment::delete_binding(VM&, FlyString const&) | ||||
| ThrowCompletionOr<bool> ModuleEnvironment::delete_binding(VM&, DeprecatedFlyString const&) | ||||
| { | ||||
|     // The DeleteBinding concrete method of a module Environment Record is never used within this specification.
 | ||||
|     VERIFY_NOT_REACHED(); | ||||
|  | @ -63,7 +63,7 @@ ThrowCompletionOr<Value> ModuleEnvironment::get_this_binding(VM&) const | |||
| } | ||||
| 
 | ||||
| // 9.1.1.5.5 CreateImportBinding ( N, M, N2 ), https://tc39.es/ecma262/#sec-createimportbinding
 | ||||
| ThrowCompletionOr<void> ModuleEnvironment::create_import_binding(FlyString name, Module* module, FlyString binding_name) | ||||
| ThrowCompletionOr<void> ModuleEnvironment::create_import_binding(DeprecatedFlyString name, Module* module, DeprecatedFlyString binding_name) | ||||
| { | ||||
|     // 1. Assert: envRec does not already have a binding for N.
 | ||||
|     VERIFY(!get_indirect_binding(name)); | ||||
|  | @ -80,7 +80,7 @@ ThrowCompletionOr<void> ModuleEnvironment::create_import_binding(FlyString name, | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| ModuleEnvironment::IndirectBinding const* ModuleEnvironment::get_indirect_binding(FlyString const& name) const | ||||
| ModuleEnvironment::IndirectBinding const* ModuleEnvironment::get_indirect_binding(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     auto binding_or_end = m_indirect_bindings.find_if([&](IndirectBinding const& binding) { | ||||
|         return binding.name == name; | ||||
|  | @ -91,7 +91,7 @@ ModuleEnvironment::IndirectBinding const* ModuleEnvironment::get_indirect_bindin | |||
|     return &(*binding_or_end); | ||||
| } | ||||
| 
 | ||||
| Optional<ModuleEnvironment::BindingAndIndex> ModuleEnvironment::find_binding_and_index(FlyString const& name) const | ||||
| Optional<ModuleEnvironment::BindingAndIndex> ModuleEnvironment::find_binding_and_index(DeprecatedFlyString const& name) const | ||||
| { | ||||
|     auto* indirect_binding = get_indirect_binding(name); | ||||
|     if (indirect_binding != nullptr) { | ||||
|  |  | |||
|  | @ -21,11 +21,11 @@ public: | |||
|     //       in Table 18 and share the same specifications for all of those methods except for
 | ||||
|     //       GetBindingValue, DeleteBinding, HasThisBinding and GetThisBinding.
 | ||||
|     //       In addition, module Environment Records support the methods listed in Table 24.
 | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, FlyString const& name) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, DeprecatedFlyString const& name) override; | ||||
|     virtual bool has_this_binding() const final { return true; } | ||||
|     virtual ThrowCompletionOr<Value> get_this_binding(VM&) const final; | ||||
|     ThrowCompletionOr<void> create_import_binding(FlyString name, Module* module, FlyString binding_name); | ||||
|     ThrowCompletionOr<void> create_import_binding(DeprecatedFlyString name, Module* module, DeprecatedFlyString binding_name); | ||||
| 
 | ||||
| private: | ||||
|     explicit ModuleEnvironment(Environment* outer_environment); | ||||
|  | @ -33,13 +33,13 @@ private: | |||
|     virtual void visit_edges(Visitor&) override; | ||||
| 
 | ||||
|     struct IndirectBinding { | ||||
|         FlyString name; | ||||
|         DeprecatedFlyString name; | ||||
|         Module* module; | ||||
|         FlyString binding_name; | ||||
|         DeprecatedFlyString binding_name; | ||||
|     }; | ||||
|     IndirectBinding const* get_indirect_binding(FlyString const& name) const; | ||||
|     IndirectBinding const* get_indirect_binding(DeprecatedFlyString const& name) const; | ||||
| 
 | ||||
|     virtual Optional<BindingAndIndex> find_binding_and_index(FlyString const& name) const override; | ||||
|     virtual Optional<BindingAndIndex> find_binding_and_index(DeprecatedFlyString const& name) const override; | ||||
| 
 | ||||
|     // FIXME: Since we always access this via the name this could be a map.
 | ||||
|     Vector<IndirectBinding> m_indirect_bindings; | ||||
|  |  | |||
|  | @ -10,14 +10,14 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| ModuleNamespaceObject::ModuleNamespaceObject(Realm& realm, Module* module, Vector<FlyString> exports) | ||||
| ModuleNamespaceObject::ModuleNamespaceObject(Realm& realm, Module* module, Vector<DeprecatedFlyString> exports) | ||||
|     : Object(ConstructWithPrototypeTag::Tag, *realm.intrinsics().object_prototype()) | ||||
|     , m_module(module) | ||||
|     , m_exports(move(exports)) | ||||
| { | ||||
|     // Note: We just perform step 6 of 10.4.6.12 ModuleNamespaceCreate ( module, exports ), https://tc39.es/ecma262/#sec-modulenamespacecreate
 | ||||
|     // 6. Let sortedExports be a List whose elements are the elements of exports ordered as if an Array of the same values had been sorted using %Array.prototype.sort% using undefined as comparefn.
 | ||||
|     quick_sort(m_exports, [&](FlyString const& lhs, FlyString const& rhs) { | ||||
|     quick_sort(m_exports, [&](DeprecatedFlyString const& lhs, DeprecatedFlyString const& rhs) { | ||||
|         return lhs.view() < rhs.view(); | ||||
|     }); | ||||
| } | ||||
|  |  | |||
|  | @ -32,11 +32,11 @@ public: | |||
|     virtual void initialize(Realm&) override; | ||||
| 
 | ||||
| private: | ||||
|     ModuleNamespaceObject(Realm&, Module* module, Vector<FlyString> exports); | ||||
|     ModuleNamespaceObject(Realm&, Module* module, Vector<DeprecatedFlyString> exports); | ||||
| 
 | ||||
|     // FIXME: UHHH how do we want to store this to avoid cycles but be safe??
 | ||||
|     Module* m_module;                      // [[Module]]
 | ||||
|     Vector<FlyString> m_exports; // [[Exports]]
 | ||||
|     Vector<DeprecatedFlyString> m_exports; // [[Exports]]
 | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Vector.h> | ||||
| 
 | ||||
| namespace JS { | ||||
|  | @ -20,19 +20,19 @@ struct ModuleRequest { | |||
| 
 | ||||
|     ModuleRequest() = default; | ||||
| 
 | ||||
|     explicit ModuleRequest(FlyString specifier) | ||||
|     explicit ModuleRequest(DeprecatedFlyString specifier) | ||||
|         : module_specifier(move(specifier)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     ModuleRequest(FlyString module_specifier, Vector<Assertion> assertions); | ||||
|     ModuleRequest(DeprecatedFlyString module_specifier, Vector<Assertion> assertions); | ||||
| 
 | ||||
|     void add_assertion(DeprecatedString key, DeprecatedString value) | ||||
|     { | ||||
|         assertions.empend(move(key), move(value)); | ||||
|     } | ||||
| 
 | ||||
|     FlyString module_specifier;   // [[Specifier]]
 | ||||
|     DeprecatedFlyString module_specifier; // [[Specifier]]
 | ||||
|     Vector<Assertion> assertions;         // [[Assertions]]
 | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -51,7 +51,7 @@ NonnullGCPtr<NativeFunction> NativeFunction::create(Realm& allocating_realm, Saf | |||
|     return function; | ||||
| } | ||||
| 
 | ||||
| NonnullGCPtr<NativeFunction> NativeFunction::create(Realm& realm, FlyString const& name, SafeFunction<ThrowCompletionOr<Value>(VM&)> function) | ||||
| NonnullGCPtr<NativeFunction> NativeFunction::create(Realm& realm, DeprecatedFlyString const& name, SafeFunction<ThrowCompletionOr<Value>(VM&)> function) | ||||
| { | ||||
|     return realm.heap().allocate<NativeFunction>(realm, name, move(function), *realm.intrinsics().function_prototype()); | ||||
| } | ||||
|  | @ -73,7 +73,7 @@ NativeFunction::NativeFunction(Object& prototype) | |||
| { | ||||
| } | ||||
| 
 | ||||
| NativeFunction::NativeFunction(FlyString name, SafeFunction<ThrowCompletionOr<Value>(VM&)> native_function, Object& prototype) | ||||
| NativeFunction::NativeFunction(DeprecatedFlyString name, SafeFunction<ThrowCompletionOr<Value>(VM&)> native_function, Object& prototype) | ||||
|     : FunctionObject(prototype) | ||||
|     , m_name(move(name)) | ||||
|     , m_native_function(move(native_function)) | ||||
|  | @ -81,7 +81,7 @@ NativeFunction::NativeFunction(FlyString name, SafeFunction<ThrowCompletionOr<Va | |||
| { | ||||
| } | ||||
| 
 | ||||
| NativeFunction::NativeFunction(FlyString name, Object& prototype) | ||||
| NativeFunction::NativeFunction(DeprecatedFlyString name, Object& prototype) | ||||
|     : FunctionObject(prototype) | ||||
|     , m_name(move(name)) | ||||
|     , m_realm(&prototype.shape().realm()) | ||||
|  |  | |||
|  | @ -21,7 +21,7 @@ class NativeFunction : public FunctionObject { | |||
| 
 | ||||
| public: | ||||
|     static NonnullGCPtr<NativeFunction> create(Realm&, SafeFunction<ThrowCompletionOr<Value>(VM&)> behaviour, i32 length, PropertyKey const& name, Optional<Realm*> = {}, Optional<Object*> prototype = {}, Optional<StringView> const& prefix = {}); | ||||
|     static NonnullGCPtr<NativeFunction> create(Realm&, FlyString const& name, SafeFunction<ThrowCompletionOr<Value>(VM&)>); | ||||
|     static NonnullGCPtr<NativeFunction> create(Realm&, DeprecatedFlyString const& name, SafeFunction<ThrowCompletionOr<Value>(VM&)>); | ||||
| 
 | ||||
|     virtual void initialize(Realm&) override { } | ||||
|     virtual ~NativeFunction() override = default; | ||||
|  | @ -34,25 +34,25 @@ public: | |||
|     virtual ThrowCompletionOr<Value> call(); | ||||
|     virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target); | ||||
| 
 | ||||
|     virtual FlyString const& name() const override { return m_name; }; | ||||
|     virtual DeprecatedFlyString const& name() const override { return m_name; }; | ||||
|     virtual bool is_strict_mode() const override; | ||||
|     virtual bool has_constructor() const override { return false; } | ||||
|     virtual Realm* realm() const override { return m_realm; } | ||||
| 
 | ||||
|     Optional<FlyString> const& initial_name() const { return m_initial_name; } | ||||
|     void set_initial_name(Badge<FunctionObject>, FlyString initial_name) { m_initial_name = move(initial_name); } | ||||
|     Optional<DeprecatedFlyString> const& initial_name() const { return m_initial_name; } | ||||
|     void set_initial_name(Badge<FunctionObject>, DeprecatedFlyString initial_name) { m_initial_name = move(initial_name); } | ||||
| 
 | ||||
| protected: | ||||
|     NativeFunction(FlyString name, Object& prototype); | ||||
|     NativeFunction(DeprecatedFlyString name, Object& prototype); | ||||
|     NativeFunction(SafeFunction<ThrowCompletionOr<Value>(VM&)>, Object* prototype, Realm& realm); | ||||
|     NativeFunction(FlyString name, SafeFunction<ThrowCompletionOr<Value>(VM&)>, Object& prototype); | ||||
|     NativeFunction(DeprecatedFlyString name, SafeFunction<ThrowCompletionOr<Value>(VM&)>, Object& prototype); | ||||
|     explicit NativeFunction(Object& prototype); | ||||
| 
 | ||||
| private: | ||||
|     virtual bool is_native_function() const final { return true; } | ||||
| 
 | ||||
|     FlyString m_name; | ||||
|     Optional<FlyString> m_initial_name; // [[InitialName]]
 | ||||
|     DeprecatedFlyString m_name; | ||||
|     Optional<DeprecatedFlyString> m_initial_name; // [[InitialName]]
 | ||||
|     SafeFunction<ThrowCompletionOr<Value>(VM&)> m_native_function; | ||||
|     Realm* m_realm { nullptr }; | ||||
| }; | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| static HashMap<Object const*, HashMap<FlyString, Object::IntrinsicAccessor>> s_intrinsics; | ||||
| static HashMap<Object const*, HashMap<DeprecatedFlyString, Object::IntrinsicAccessor>> s_intrinsics; | ||||
| 
 | ||||
| // 10.1.12 OrdinaryObjectCreate ( proto [ , additionalInternalSlotsList ] ), https://tc39.es/ecma262/#sec-ordinaryobjectcreate
 | ||||
| NonnullGCPtr<Object> Object::create(Realm& realm, Object* prototype) | ||||
|  | @ -1259,7 +1259,7 @@ Optional<Completion> Object::enumerate_object_properties(Function<Optional<Compl | |||
|     //    * Enumerating the properties of the target object includes enumerating properties of its prototype, and the prototype of the prototype, and so on, recursively.
 | ||||
|     //    * A property of a prototype is not processed if it has the same name as a property that has already been processed.
 | ||||
| 
 | ||||
|     HashTable<FlyString> visited; | ||||
|     HashTable<DeprecatedFlyString> visited; | ||||
| 
 | ||||
|     auto const* target = this; | ||||
|     while (target) { | ||||
|  | @ -1267,7 +1267,7 @@ Optional<Completion> Object::enumerate_object_properties(Function<Optional<Compl | |||
|         for (auto& key : own_keys) { | ||||
|             if (!key.is_string()) | ||||
|                 continue; | ||||
|             FlyString property_key = TRY(key.as_string().deprecated_string()); | ||||
|             DeprecatedFlyString property_key = TRY(key.as_string().deprecated_string()); | ||||
|             if (visited.contains(property_key)) | ||||
|                 continue; | ||||
|             auto descriptor = TRY(target->internal_get_own_property(property_key)); | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ void ObjectEnvironment::visit_edges(Cell::Visitor& visitor) | |||
| } | ||||
| 
 | ||||
| // 9.1.1.2.1 HasBinding ( N ), https://tc39.es/ecma262/#sec-object-environment-records-hasbinding-n
 | ||||
| ThrowCompletionOr<bool> ObjectEnvironment::has_binding(FlyString const& name, Optional<size_t>*) const | ||||
| ThrowCompletionOr<bool> ObjectEnvironment::has_binding(DeprecatedFlyString const& name, Optional<size_t>*) const | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -59,7 +59,7 @@ ThrowCompletionOr<bool> ObjectEnvironment::has_binding(FlyString const& name, Op | |||
| } | ||||
| 
 | ||||
| // 9.1.1.2.2 CreateMutableBinding ( N, D ), https://tc39.es/ecma262/#sec-object-environment-records-createmutablebinding-n-d
 | ||||
| ThrowCompletionOr<void> ObjectEnvironment::create_mutable_binding(VM&, FlyString const& name, bool can_be_deleted) | ||||
| ThrowCompletionOr<void> ObjectEnvironment::create_mutable_binding(VM&, DeprecatedFlyString const& name, bool can_be_deleted) | ||||
| { | ||||
|     // 1. Let bindingObject be envRec.[[BindingObject]].
 | ||||
|     // 2. Perform ? DefinePropertyOrThrow(bindingObject, N, PropertyDescriptor { [[Value]]: undefined, [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: D }).
 | ||||
|  | @ -70,14 +70,14 @@ ThrowCompletionOr<void> ObjectEnvironment::create_mutable_binding(VM&, FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.2.3 CreateImmutableBinding ( N, S ), https://tc39.es/ecma262/#sec-object-environment-records-createimmutablebinding-n-s
 | ||||
| ThrowCompletionOr<void> ObjectEnvironment::create_immutable_binding(VM&, FlyString const&, bool) | ||||
| ThrowCompletionOr<void> ObjectEnvironment::create_immutable_binding(VM&, DeprecatedFlyString const&, bool) | ||||
| { | ||||
|     // "The CreateImmutableBinding concrete method of an object Environment Record is never used within this specification."
 | ||||
|     VERIFY_NOT_REACHED(); | ||||
| } | ||||
| 
 | ||||
| // 9.1.1.2.4 InitializeBinding ( N, V ), https://tc39.es/ecma262/#sec-object-environment-records-initializebinding-n-v
 | ||||
| ThrowCompletionOr<void> ObjectEnvironment::initialize_binding(VM& vm, FlyString const& name, Value value) | ||||
| ThrowCompletionOr<void> ObjectEnvironment::initialize_binding(VM& vm, DeprecatedFlyString const& name, Value value) | ||||
| { | ||||
|     // 1. Perform ? envRec.SetMutableBinding(N, V, false).
 | ||||
|     TRY(set_mutable_binding(vm, name, value, false)); | ||||
|  | @ -87,7 +87,7 @@ ThrowCompletionOr<void> ObjectEnvironment::initialize_binding(VM& vm, FlyString | |||
| } | ||||
| 
 | ||||
| // 9.1.1.2.5 SetMutableBinding ( N, V, S ), https://tc39.es/ecma262/#sec-object-environment-records-setmutablebinding-n-v-s
 | ||||
| ThrowCompletionOr<void> ObjectEnvironment::set_mutable_binding(VM&, FlyString const& name, Value value, bool strict) | ||||
| ThrowCompletionOr<void> ObjectEnvironment::set_mutable_binding(VM&, DeprecatedFlyString const& name, Value value, bool strict) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -129,7 +129,7 @@ ThrowCompletionOr<void> ObjectEnvironment::set_mutable_binding(VM&, FlyString co | |||
| } | ||||
| 
 | ||||
| // 9.1.1.2.6 GetBindingValue ( N, S ), https://tc39.es/ecma262/#sec-object-environment-records-getbindingvalue-n-s
 | ||||
| ThrowCompletionOr<Value> ObjectEnvironment::get_binding_value(VM&, FlyString const& name, bool strict) | ||||
| ThrowCompletionOr<Value> ObjectEnvironment::get_binding_value(VM&, DeprecatedFlyString const& name, bool strict) | ||||
| { | ||||
|     auto& vm = this->vm(); | ||||
| 
 | ||||
|  | @ -158,7 +158,7 @@ ThrowCompletionOr<Value> ObjectEnvironment::get_binding_value(VM&, FlyString con | |||
| } | ||||
| 
 | ||||
| // 9.1.1.2.7 DeleteBinding ( N ), https://tc39.es/ecma262/#sec-object-environment-records-deletebinding-n
 | ||||
| ThrowCompletionOr<bool> ObjectEnvironment::delete_binding(VM&, FlyString const& name) | ||||
| ThrowCompletionOr<bool> ObjectEnvironment::delete_binding(VM&, DeprecatedFlyString const& name) | ||||
| { | ||||
|     // 1. Let bindingObject be envRec.[[BindingObject]].
 | ||||
|     // 2. Return ? bindingObject.[[Delete]](N).
 | ||||
|  |  | |||
|  | @ -19,13 +19,13 @@ public: | |||
|         Yes, | ||||
|     }; | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<bool> has_binding(FlyString const& name, Optional<size_t>* = nullptr) const override; | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, FlyString const& name, bool can_be_deleted) override; | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, FlyString const& name, Value) override; | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, FlyString const& name, Value, bool strict) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, FlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, FlyString const& name) override; | ||||
|     virtual ThrowCompletionOr<bool> has_binding(DeprecatedFlyString const& name, Optional<size_t>* = nullptr) const override; | ||||
|     virtual ThrowCompletionOr<void> create_mutable_binding(VM&, DeprecatedFlyString const& name, bool can_be_deleted) override; | ||||
|     virtual ThrowCompletionOr<void> create_immutable_binding(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<void> initialize_binding(VM&, DeprecatedFlyString const& name, Value) override; | ||||
|     virtual ThrowCompletionOr<void> set_mutable_binding(VM&, DeprecatedFlyString const& name, Value, bool strict) override; | ||||
|     virtual ThrowCompletionOr<Value> get_binding_value(VM&, DeprecatedFlyString const& name, bool strict) override; | ||||
|     virtual ThrowCompletionOr<bool> delete_binding(VM&, DeprecatedFlyString const& name) override; | ||||
| 
 | ||||
|     // 9.1.1.2.10 WithBaseObject ( ), https://tc39.es/ecma262/#sec-object-environment-records-withbaseobject
 | ||||
|     virtual Object* with_base_object() const override | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ PrivateEnvironment::PrivateEnvironment(PrivateEnvironment* parent) | |||
| // Note: we start at one such that 0 can be invalid / default initialized.
 | ||||
| u64 PrivateEnvironment::s_next_id = 1u; | ||||
| 
 | ||||
| PrivateName PrivateEnvironment::resolve_private_identifier(FlyString const& identifier) const | ||||
| PrivateName PrivateEnvironment::resolve_private_identifier(DeprecatedFlyString const& identifier) const | ||||
| { | ||||
|     auto name_or_end = find_private_name(identifier); | ||||
| 
 | ||||
|  | @ -32,7 +32,7 @@ PrivateName PrivateEnvironment::resolve_private_identifier(FlyString const& iden | |||
|     return m_outer_environment->resolve_private_identifier(identifier); | ||||
| } | ||||
| 
 | ||||
| void PrivateEnvironment::add_private_name(Badge<ClassExpression>, FlyString description) | ||||
| void PrivateEnvironment::add_private_name(Badge<ClassExpression>, DeprecatedFlyString description) | ||||
| { | ||||
|     if (!find_private_name(description).is_end()) | ||||
|         return; | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/StringView.h> | ||||
| #include <AK/Vector.h> | ||||
| #include <LibJS/Heap/Cell.h> | ||||
|  | @ -15,14 +15,14 @@ namespace JS { | |||
| 
 | ||||
| struct PrivateName { | ||||
|     PrivateName() = default; | ||||
|     PrivateName(u64 unique_id, FlyString description) | ||||
|     PrivateName(u64 unique_id, DeprecatedFlyString description) | ||||
|         : unique_id(unique_id) | ||||
|         , description(move(description)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     u64 unique_id { 0 }; | ||||
|     FlyString description; | ||||
|     DeprecatedFlyString description; | ||||
| 
 | ||||
|     bool operator==(PrivateName const& rhs) const; | ||||
| }; | ||||
|  | @ -31,16 +31,16 @@ class PrivateEnvironment : public Cell { | |||
|     JS_CELL(PrivateEnvironment, Cell); | ||||
| 
 | ||||
| public: | ||||
|     PrivateName resolve_private_identifier(FlyString const& identifier) const; | ||||
|     PrivateName resolve_private_identifier(DeprecatedFlyString const& identifier) const; | ||||
| 
 | ||||
|     void add_private_name(Badge<ClassExpression>, FlyString description); | ||||
|     void add_private_name(Badge<ClassExpression>, DeprecatedFlyString description); | ||||
| 
 | ||||
| private: | ||||
|     explicit PrivateEnvironment(PrivateEnvironment* parent); | ||||
| 
 | ||||
|     virtual void visit_edges(Visitor&) override; | ||||
| 
 | ||||
|     auto find_private_name(FlyString const& description) const | ||||
|     auto find_private_name(DeprecatedFlyString const& description) const | ||||
|     { | ||||
|         return m_private_names.find_if([&](PrivateName const& private_name) { | ||||
|             return private_name.description == description; | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <LibJS/Heap/Handle.h> | ||||
| #include <LibJS/Runtime/Completion.h> | ||||
| #include <LibJS/Runtime/StringOrSymbol.h> | ||||
|  | @ -61,18 +61,18 @@ public: | |||
| 
 | ||||
|     PropertyKey(char const* chars) | ||||
|         : m_type(Type::String) | ||||
|         , m_string(FlyString(chars)) | ||||
|         , m_string(DeprecatedFlyString(chars)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     PropertyKey(DeprecatedString const& string) | ||||
|         : m_type(Type::String) | ||||
|         , m_string(FlyString(string)) | ||||
|         , m_string(DeprecatedFlyString(string)) | ||||
|     { | ||||
|         VERIFY(!m_string.is_null()); | ||||
|     } | ||||
| 
 | ||||
|     PropertyKey(FlyString string, StringMayBeNumber string_may_be_number = StringMayBeNumber::Yes) | ||||
|     PropertyKey(DeprecatedFlyString string, StringMayBeNumber 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)) | ||||
|  | @ -152,7 +152,7 @@ public: | |||
|         return m_number; | ||||
|     } | ||||
| 
 | ||||
|     FlyString const& as_string() const | ||||
|     DeprecatedFlyString const& as_string() const | ||||
|     { | ||||
|         VERIFY(is_string()); | ||||
|         return m_string; | ||||
|  | @ -186,7 +186,7 @@ private: | |||
|     bool m_string_may_be_number { true }; | ||||
|     Type m_type { Type::Invalid }; | ||||
|     u32 m_number { 0 }; | ||||
|     FlyString m_string; | ||||
|     DeprecatedFlyString m_string; | ||||
|     Handle<Symbol> m_symbol; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -832,7 +832,7 @@ void ProxyObject::visit_edges(Cell::Visitor& visitor) | |||
|     visitor.visit(&m_handler); | ||||
| } | ||||
| 
 | ||||
| FlyString const& ProxyObject::name() const | ||||
| DeprecatedFlyString const& ProxyObject::name() const | ||||
| { | ||||
|     VERIFY(is_function()); | ||||
|     return static_cast<FunctionObject&>(m_target).name(); | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ public: | |||
| 
 | ||||
|     virtual ~ProxyObject() override = default; | ||||
| 
 | ||||
|     virtual FlyString const& name() const override; | ||||
|     virtual DeprecatedFlyString const& name() const override; | ||||
|     virtual bool has_constructor() const override; | ||||
| 
 | ||||
|     Object const& target() const { return m_target; } | ||||
|  |  | |||
|  | @ -239,7 +239,7 @@ ThrowCompletionOr<void> Reference::initialize_referenced_binding(VM& vm, Value v | |||
| } | ||||
| 
 | ||||
| // 6.2.4.9 MakePrivateReference ( baseValue, privateIdentifier ), https://tc39.es/ecma262/#sec-makeprivatereference
 | ||||
| Reference make_private_reference(VM& vm, Value base_value, FlyString const& private_identifier) | ||||
| Reference make_private_reference(VM& vm, Value base_value, DeprecatedFlyString const& private_identifier) | ||||
| { | ||||
|     // 1. Let privEnv be the running execution context's PrivateEnvironment.
 | ||||
|     auto* private_environment = vm.running_execution_context().private_environment; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| Reference make_private_reference(VM&, Value base_value, FlyString const& private_identifier); | ||||
| Reference make_private_reference(VM&, Value base_value, DeprecatedFlyString const& private_identifier); | ||||
| 
 | ||||
| class Reference { | ||||
| public: | ||||
|  | @ -47,7 +47,7 @@ public: | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     Reference(Environment& base, FlyString referenced_name, bool strict = false, Optional<EnvironmentCoordinate> environment_coordinate = {}) | ||||
|     Reference(Environment& base, DeprecatedFlyString referenced_name, bool strict = false, Optional<EnvironmentCoordinate> environment_coordinate = {}) | ||||
|         : m_base_type(BaseType::Environment) | ||||
|         , m_base_environment(&base) | ||||
|         , m_name(move(referenced_name)) | ||||
|  |  | |||
|  | @ -95,7 +95,7 @@ static Value get_match_index_par(VM& vm, Utf16View const& string, Match const& m | |||
| } | ||||
| 
 | ||||
| // 22.2.5.2.8 MakeMatchIndicesIndexPairArray ( S, indices, groupNames, hasGroups ), https://tc39.es/ecma262/#sec-makematchindicesindexpairarray
 | ||||
| static Value make_match_indices_index_pair_array(VM& vm, Utf16View const& string, Vector<Optional<Match>> const& indices, HashMap<FlyString, Match> const& group_names, bool has_groups) | ||||
| static Value make_match_indices_index_pair_array(VM& vm, Utf16View const& string, Vector<Optional<Match>> const& indices, HashMap<DeprecatedFlyString, Match> const& group_names, bool has_groups) | ||||
| { | ||||
|     // Note: This implementation differs from the spec, but has the same behavior.
 | ||||
|     //
 | ||||
|  | @ -268,7 +268,7 @@ static ThrowCompletionOr<Value> regexp_builtin_exec(VM& vm, RegExpObject& regexp | |||
|     Vector<Utf16String> captured_values; | ||||
| 
 | ||||
|     // 25. Let groupNames be a new empty List.
 | ||||
|     HashMap<FlyString, Match> group_names; | ||||
|     HashMap<DeprecatedFlyString, Match> group_names; | ||||
| 
 | ||||
|     // 26. Add match as the last element of indices.
 | ||||
|     indices.append(move(match_indices)); | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <LibJS/Runtime/PrimitiveString.h> | ||||
| #include <LibJS/Runtime/Symbol.h> | ||||
| #include <LibJS/Runtime/Value.h> | ||||
|  | @ -18,16 +18,16 @@ public: | |||
|     StringOrSymbol() = default; | ||||
| 
 | ||||
|     StringOrSymbol(char const* chars) | ||||
|         : StringOrSymbol(FlyString(chars)) | ||||
|         : StringOrSymbol(DeprecatedFlyString(chars)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     StringOrSymbol(DeprecatedString const& string) | ||||
|         : StringOrSymbol(FlyString(string)) | ||||
|         : StringOrSymbol(DeprecatedFlyString(string)) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     StringOrSymbol(FlyString const& string) | ||||
|     StringOrSymbol(DeprecatedFlyString const& string) | ||||
|         : m_ptr(string.impl()) | ||||
|     { | ||||
|         VERIFY(!string.is_null()); | ||||
|  | @ -62,10 +62,10 @@ public: | |||
|     ALWAYS_INLINE bool is_symbol() const { return is_valid() && (bits() & 1ul); } | ||||
|     ALWAYS_INLINE bool is_string() const { return is_valid() && !(bits() & 1ul); } | ||||
| 
 | ||||
|     ALWAYS_INLINE FlyString as_string() const | ||||
|     ALWAYS_INLINE DeprecatedFlyString as_string() const | ||||
|     { | ||||
|         VERIFY(is_string()); | ||||
|         return FlyString::from_fly_impl(as_string_impl()); | ||||
|         return DeprecatedFlyString::from_fly_impl(as_string_impl()); | ||||
|     } | ||||
| 
 | ||||
|     ALWAYS_INLINE Symbol const* as_symbol() const | ||||
|  |  | |||
|  | @ -453,7 +453,7 @@ void TypedArrayBase::visit_edges(Visitor& visitor) | |||
|     {                                                                                                                            \ | ||||
|     }                                                                                                                            \ | ||||
|                                                                                                                                  \ | ||||
|     FlyString const& ClassName::element_name() const                                                                             \ | ||||
|     DeprecatedFlyString const& ClassName::element_name() const                                                                   \ | ||||
|     {                                                                                                                            \ | ||||
|         return vm().names.ClassName.as_string();                                                                                 \ | ||||
|     }                                                                                                                            \ | ||||
|  |  | |||
|  | @ -47,7 +47,7 @@ public: | |||
|     void set_viewed_array_buffer(ArrayBuffer* array_buffer) { m_viewed_array_buffer = array_buffer; } | ||||
| 
 | ||||
|     virtual size_t element_size() const = 0; | ||||
|     virtual FlyString const& element_name() const = 0; | ||||
|     virtual DeprecatedFlyString const& element_name() const = 0; | ||||
| 
 | ||||
|     // 25.1.2.6 IsUnclampedIntegerElementType ( type ), https://tc39.es/ecma262/#sec-isunclampedintegerelementtype
 | ||||
|     virtual bool is_unclamped_integer_element_type() const = 0; | ||||
|  | @ -470,7 +470,7 @@ ThrowCompletionOr<double> compare_typed_array_elements(VM&, Value x, Value y, Fu | |||
|         static ThrowCompletionOr<NonnullGCPtr<ClassName>> create(Realm&, u32 length, FunctionObject& new_target); \ | ||||
|         static ThrowCompletionOr<NonnullGCPtr<ClassName>> create(Realm&, u32 length);                             \ | ||||
|         static NonnullGCPtr<ClassName> create(Realm&, u32 length, ArrayBuffer& buffer);                           \ | ||||
|         virtual FlyString const& element_name() const override;                                                   \ | ||||
|         virtual DeprecatedFlyString const& element_name() const override;                                         \ | ||||
|                                                                                                                   \ | ||||
|     protected:                                                                                                    \ | ||||
|         ClassName(Object& prototype, u32 length, ArrayBuffer& array_buffer);                                      \ | ||||
|  |  | |||
|  | @ -11,7 +11,7 @@ | |||
| 
 | ||||
| namespace JS { | ||||
| 
 | ||||
| TypedArrayConstructor::TypedArrayConstructor(FlyString const& name, Object& prototype) | ||||
| TypedArrayConstructor::TypedArrayConstructor(DeprecatedFlyString const& name, Object& prototype) | ||||
|     : NativeFunction(name, prototype) | ||||
| { | ||||
| } | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ public: | |||
|     virtual ThrowCompletionOr<NonnullGCPtr<Object>> construct(FunctionObject& new_target) override; | ||||
| 
 | ||||
| protected: | ||||
|     TypedArrayConstructor(FlyString const& name, Object& prototype); | ||||
|     TypedArrayConstructor(DeprecatedFlyString const& name, Object& prototype); | ||||
| 
 | ||||
| private: | ||||
|     virtual bool has_constructor() const override { return true; } | ||||
|  |  | |||
|  | @ -231,7 +231,7 @@ void VM::gather_roots(HashTable<Cell*>& roots) | |||
|         roots.set(finalization_registry); | ||||
| } | ||||
| 
 | ||||
| ThrowCompletionOr<Value> VM::named_evaluation_if_anonymous_function(ASTNode const& expression, FlyString const& name) | ||||
| ThrowCompletionOr<Value> VM::named_evaluation_if_anonymous_function(ASTNode const& expression, DeprecatedFlyString const& name) | ||||
| { | ||||
|     // 8.3.3 Static Semantics: IsAnonymousFunctionDefinition ( expr ), https://tc39.es/ecma262/#sec-isanonymousfunctiondefinition
 | ||||
|     // And 8.3.5 Runtime Semantics: NamedEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-namedevaluation
 | ||||
|  | @ -260,7 +260,7 @@ ThrowCompletionOr<void> VM::destructuring_assignment_evaluation(NonnullRefPtr<Bi | |||
| } | ||||
| 
 | ||||
| // 8.5.2 Runtime Semantics: BindingInitialization, https://tc39.es/ecma262/#sec-runtime-semantics-bindinginitialization
 | ||||
| ThrowCompletionOr<void> VM::binding_initialization(FlyString const& target, Value value, Environment* environment) | ||||
| ThrowCompletionOr<void> VM::binding_initialization(DeprecatedFlyString const& target, Value value, Environment* environment) | ||||
| { | ||||
|     // 1. Let name be StringValue of Identifier.
 | ||||
|     // 2. Return ? InitializeBoundName(name, value, environment).
 | ||||
|  | @ -541,7 +541,7 @@ ThrowCompletionOr<void> VM::iterator_binding_initialization(BindingPattern const | |||
| } | ||||
| 
 | ||||
| // 9.1.2.1 GetIdentifierReference ( env, name, strict ), https://tc39.es/ecma262/#sec-getidentifierreference
 | ||||
| ThrowCompletionOr<Reference> VM::get_identifier_reference(Environment* environment, FlyString name, bool strict, size_t hops) | ||||
| ThrowCompletionOr<Reference> VM::get_identifier_reference(Environment* environment, DeprecatedFlyString name, bool strict, size_t hops) | ||||
| { | ||||
|     // 1. If env is the value null, then
 | ||||
|     if (!environment) { | ||||
|  | @ -575,7 +575,7 @@ ThrowCompletionOr<Reference> VM::get_identifier_reference(Environment* environme | |||
| } | ||||
| 
 | ||||
| // 9.4.2 ResolveBinding ( name [ , env ] ), https://tc39.es/ecma262/#sec-resolvebinding
 | ||||
| ThrowCompletionOr<Reference> VM::resolve_binding(FlyString const& name, Environment* environment) | ||||
| ThrowCompletionOr<Reference> VM::resolve_binding(DeprecatedFlyString const& name, Environment* environment) | ||||
| { | ||||
|     // 1. If env is not present or if env is undefined, then
 | ||||
|     if (!environment) { | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Function.h> | ||||
| #include <AK/HashMap.h> | ||||
| #include <AK/RefCounted.h> | ||||
|  | @ -175,8 +175,8 @@ public: | |||
|     u32 execution_generation() const { return m_execution_generation; } | ||||
|     void finish_execution_generation() { ++m_execution_generation; } | ||||
| 
 | ||||
|     ThrowCompletionOr<Reference> resolve_binding(FlyString const&, Environment* = nullptr); | ||||
|     ThrowCompletionOr<Reference> get_identifier_reference(Environment*, FlyString, bool strict, size_t hops = 0); | ||||
|     ThrowCompletionOr<Reference> resolve_binding(DeprecatedFlyString const&, Environment* = nullptr); | ||||
|     ThrowCompletionOr<Reference> get_identifier_reference(Environment*, DeprecatedFlyString, bool strict, size_t hops = 0); | ||||
| 
 | ||||
|     // 5.2.3.2 Throw an Exception, https://tc39.es/ecma262/#sec-throw-an-exception
 | ||||
|     template<typename T, typename... Args> | ||||
|  | @ -213,10 +213,10 @@ public: | |||
|     CustomData* custom_data() { return m_custom_data; } | ||||
| 
 | ||||
|     ThrowCompletionOr<void> destructuring_assignment_evaluation(NonnullRefPtr<BindingPattern> const& target, Value value); | ||||
|     ThrowCompletionOr<void> binding_initialization(FlyString const& target, Value value, Environment* environment); | ||||
|     ThrowCompletionOr<void> binding_initialization(DeprecatedFlyString const& target, Value value, Environment* environment); | ||||
|     ThrowCompletionOr<void> binding_initialization(NonnullRefPtr<BindingPattern> const& target, Value value, Environment* environment); | ||||
| 
 | ||||
|     ThrowCompletionOr<Value> named_evaluation_if_anonymous_function(ASTNode const& expression, FlyString const& name); | ||||
|     ThrowCompletionOr<Value> named_evaluation_if_anonymous_function(ASTNode const& expression, DeprecatedFlyString const& name); | ||||
| 
 | ||||
|     void save_execution_context_stack(); | ||||
|     void restore_execution_context_stack(); | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ public: | |||
|     virtual ThrowCompletionOr<Value> internal_call(Value this_argument, MarkedVector<Value> arguments_list) override; | ||||
| 
 | ||||
|     // FIXME: Remove this (and stop inventing random internal slots that shouldn't exist, jeez)
 | ||||
|     virtual FlyString const& name() const override { return m_wrapped_target_function.name(); } | ||||
|     virtual DeprecatedFlyString const& name() const override { return m_wrapped_target_function.name(); } | ||||
| 
 | ||||
|     virtual Realm* realm() const override { return &m_realm; } | ||||
| 
 | ||||
|  |  | |||
|  | @ -260,7 +260,7 @@ Result<NonnullGCPtr<SourceTextModule>, Vector<ParserError>> SourceTextModule::pa | |||
| } | ||||
| 
 | ||||
| // 16.2.1.6.2 GetExportedNames ( [ exportStarSet ] ), https://tc39.es/ecma262/#sec-getexportednames
 | ||||
| ThrowCompletionOr<Vector<FlyString>> SourceTextModule::get_exported_names(VM& vm, Vector<Module*> export_star_set) | ||||
| ThrowCompletionOr<Vector<DeprecatedFlyString>> SourceTextModule::get_exported_names(VM& vm, Vector<Module*> export_star_set) | ||||
| { | ||||
|     dbgln_if(JS_MODULE_DEBUG, "[JS MODULE] get_export_names of {}", filename()); | ||||
|     // 1. If exportStarSet is not present, set exportStarSet to a new empty List.
 | ||||
|  | @ -272,14 +272,14 @@ ThrowCompletionOr<Vector<FlyString>> SourceTextModule::get_exported_names(VM& vm | |||
|         // FIXME: How do we check that?
 | ||||
| 
 | ||||
|         // b. Return a new empty List.
 | ||||
|         return Vector<FlyString> {}; | ||||
|         return Vector<DeprecatedFlyString> {}; | ||||
|     } | ||||
| 
 | ||||
|     // 3. Append module to exportStarSet.
 | ||||
|     export_star_set.append(this); | ||||
| 
 | ||||
|     // 4. Let exportedNames be a new empty List.
 | ||||
|     Vector<FlyString> exported_names; | ||||
|     Vector<DeprecatedFlyString> exported_names; | ||||
| 
 | ||||
|     // 5. For each ExportEntry Record e of module.[[LocalExportEntries]], do
 | ||||
|     for (auto& entry : m_local_export_entries) { | ||||
|  | @ -432,7 +432,7 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm) | |||
|     // Note: We just loop through them in step 21.
 | ||||
| 
 | ||||
|     // 20. Let declaredVarNames be a new empty List.
 | ||||
|     Vector<FlyString> declared_var_names; | ||||
|     Vector<DeprecatedFlyString> declared_var_names; | ||||
| 
 | ||||
|     // 21. For each element d of varDeclarations, do
 | ||||
|     // a. For each element dn of the BoundNames of d, do
 | ||||
|  | @ -459,7 +459,7 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm) | |||
|     // 24. For each element d of lexDeclarations, do
 | ||||
|     m_ecmascript_code->for_each_lexically_scoped_declaration([&](Declaration const& declaration) { | ||||
|         // a. For each element dn of the BoundNames of d, do
 | ||||
|         declaration.for_each_bound_name([&](FlyString const& name) { | ||||
|         declaration.for_each_bound_name([&](DeprecatedFlyString const& name) { | ||||
|             // i. If IsConstantDeclaration of d is true, then
 | ||||
|             if (declaration.is_constant_declaration()) { | ||||
|                 // 1. Perform ! env.CreateImmutableBinding(dn, true).
 | ||||
|  | @ -479,7 +479,7 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm) | |||
|                 // 1. Let fo be InstantiateFunctionObject of d with arguments env and privateEnv.
 | ||||
|                 // NOTE: Special case if the function is a default export of an anonymous function
 | ||||
|                 //       it has name "*default*" but internally should have name "default".
 | ||||
|                 FlyString function_name = function_declaration.name(); | ||||
|                 DeprecatedFlyString function_name = function_declaration.name(); | ||||
|                 if (function_name == ExportStatement::local_name_for_default) | ||||
|                     function_name = "default"sv; | ||||
|                 auto function = ECMAScriptFunctionObject::create(realm(), function_name, function_declaration.source_text(), function_declaration.body(), function_declaration.parameters(), function_declaration.function_length(), environment, private_environment, function_declaration.kind(), function_declaration.is_strict_mode(), function_declaration.might_need_arguments_object(), function_declaration.contains_direct_call_to_eval()); | ||||
|  | @ -518,7 +518,7 @@ ThrowCompletionOr<void> SourceTextModule::initialize_environment(VM& vm) | |||
| } | ||||
| 
 | ||||
| // 16.2.1.6.3 ResolveExport ( exportName [ , resolveSet ] ), https://tc39.es/ecma262/#sec-resolveexport
 | ||||
| ThrowCompletionOr<ResolvedBinding> SourceTextModule::resolve_export(VM& vm, FlyString const& export_name, Vector<ResolvedBinding> resolve_set) | ||||
| ThrowCompletionOr<ResolvedBinding> SourceTextModule::resolve_export(VM& vm, DeprecatedFlyString const& export_name, Vector<ResolvedBinding> resolve_set) | ||||
| { | ||||
|     // 1. If resolveSet is not present, set resolveSet to a new empty List.
 | ||||
|     // Note: This is done by the default argument.
 | ||||
|  |  | |||
|  | @ -22,8 +22,8 @@ public: | |||
| 
 | ||||
|     Program const& parse_node() const { return *m_ecmascript_code; } | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<Vector<FlyString>> get_exported_names(VM& vm, Vector<Module*> export_star_set) override; | ||||
|     virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, FlyString const& export_name, Vector<ResolvedBinding> resolve_set = {}) override; | ||||
|     virtual ThrowCompletionOr<Vector<DeprecatedFlyString>> get_exported_names(VM& vm, Vector<Module*> export_star_set) override; | ||||
|     virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, DeprecatedFlyString const& export_name, Vector<ResolvedBinding> resolve_set = {}) override; | ||||
| 
 | ||||
|     Object* import_meta() { return m_import_meta; } | ||||
|     void set_import_meta(Badge<MetaProperty>, Object* import_meta) { m_import_meta = import_meta; } | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| namespace JS { | ||||
| 
 | ||||
| // 1.2.1 CreateSyntheticModule ( exportNames, evaluationSteps, realm, hostDefined ), https://tc39.es/proposal-json-modules/#sec-createsyntheticmodule
 | ||||
| SyntheticModule::SyntheticModule(Vector<FlyString> export_names, SyntheticModule::EvaluationFunction evaluation_steps, Realm& realm, StringView filename) | ||||
| SyntheticModule::SyntheticModule(Vector<DeprecatedFlyString> export_names, SyntheticModule::EvaluationFunction evaluation_steps, Realm& realm, StringView filename) | ||||
|     : Module(realm, filename) | ||||
|     , m_export_names(move(export_names)) | ||||
|     , m_evaluation_steps(move(evaluation_steps)) | ||||
|  | @ -23,14 +23,14 @@ SyntheticModule::SyntheticModule(Vector<FlyString> export_names, SyntheticModule | |||
| } | ||||
| 
 | ||||
| // 1.2.3.1 GetExportedNames( exportStarSet ), https://tc39.es/proposal-json-modules/#sec-smr-getexportednames
 | ||||
| ThrowCompletionOr<Vector<FlyString>> SyntheticModule::get_exported_names(VM&, Vector<Module*>) | ||||
| ThrowCompletionOr<Vector<DeprecatedFlyString>> SyntheticModule::get_exported_names(VM&, Vector<Module*>) | ||||
| { | ||||
|     // 1. Return module.[[ExportNames]].
 | ||||
|     return m_export_names; | ||||
| } | ||||
| 
 | ||||
| // 1.2.3.2 ResolveExport( exportName, resolveSet ), https://tc39.es/proposal-json-modules/#sec-smr-resolveexport
 | ||||
| ThrowCompletionOr<ResolvedBinding> SyntheticModule::resolve_export(VM&, FlyString const& export_name, Vector<ResolvedBinding>) | ||||
| ThrowCompletionOr<ResolvedBinding> SyntheticModule::resolve_export(VM&, DeprecatedFlyString const& export_name, Vector<ResolvedBinding>) | ||||
| { | ||||
|     // 1. If module.[[ExportNames]] does not contain exportName, return null.
 | ||||
|     if (!m_export_names.contains_slow(export_name)) | ||||
|  | @ -119,7 +119,7 @@ ThrowCompletionOr<Promise*> SyntheticModule::evaluate(VM& vm) | |||
| } | ||||
| 
 | ||||
| // 1.2.2 SetSyntheticModuleExport ( module, exportName, exportValue ), https://tc39.es/proposal-json-modules/#sec-setsyntheticmoduleexport
 | ||||
| ThrowCompletionOr<void> SyntheticModule::set_synthetic_module_export(FlyString const& export_name, Value export_value) | ||||
| ThrowCompletionOr<void> SyntheticModule::set_synthetic_module_export(DeprecatedFlyString const& export_name, Value export_value) | ||||
| { | ||||
|     auto& vm = this->realm().vm(); | ||||
| 
 | ||||
|  | @ -139,7 +139,7 @@ NonnullGCPtr<SyntheticModule> SyntheticModule::create_default_export_synthetic_m | |||
|     }; | ||||
| 
 | ||||
|     // 2. Return CreateSyntheticModule("default", closure, realm)
 | ||||
|     return realm.heap().allocate_without_realm<SyntheticModule>(Vector<FlyString> { "default" }, move(closure), realm, filename); | ||||
|     return realm.heap().allocate_without_realm<SyntheticModule>(Vector<DeprecatedFlyString> { "default" }, move(closure), realm, filename); | ||||
| } | ||||
| 
 | ||||
| // 1.4 ParseJSONModule ( source ), https://tc39.es/proposal-json-modules/#sec-parse-json-module
 | ||||
|  |  | |||
|  | @ -19,17 +19,17 @@ public: | |||
| 
 | ||||
|     static NonnullGCPtr<SyntheticModule> create_default_export_synthetic_module(Value default_export, Realm& realm, StringView filename); | ||||
| 
 | ||||
|     ThrowCompletionOr<void> set_synthetic_module_export(FlyString const& export_name, Value export_value); | ||||
|     ThrowCompletionOr<void> set_synthetic_module_export(DeprecatedFlyString const& export_name, Value export_value); | ||||
| 
 | ||||
|     virtual ThrowCompletionOr<void> link(VM& vm) override; | ||||
|     virtual ThrowCompletionOr<Promise*> evaluate(VM& vm) override; | ||||
|     virtual ThrowCompletionOr<Vector<FlyString>> get_exported_names(VM& vm, Vector<Module*> export_star_set) override; | ||||
|     virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, FlyString const& export_name, Vector<ResolvedBinding> resolve_set) override; | ||||
|     virtual ThrowCompletionOr<Vector<DeprecatedFlyString>> get_exported_names(VM& vm, Vector<Module*> export_star_set) override; | ||||
|     virtual ThrowCompletionOr<ResolvedBinding> resolve_export(VM& vm, DeprecatedFlyString const& export_name, Vector<ResolvedBinding> resolve_set) override; | ||||
| 
 | ||||
| private: | ||||
|     SyntheticModule(Vector<FlyString> export_names, EvaluationFunction evaluation_steps, Realm& realm, StringView filename); | ||||
|     SyntheticModule(Vector<DeprecatedFlyString> export_names, EvaluationFunction evaluation_steps, Realm& realm, StringView filename); | ||||
| 
 | ||||
|     Vector<FlyString> m_export_names;      // [[ExportNames]]
 | ||||
|     Vector<DeprecatedFlyString> m_export_names; // [[ExportNames]]
 | ||||
|     EvaluationFunction m_evaluation_steps;      // [[EvaluationSteps]]
 | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,8 +6,8 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/DeprecatedString.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/StringView.h> | ||||
| #include <AK/Variant.h> | ||||
| 
 | ||||
|  | @ -207,16 +207,16 @@ public: | |||
|     { | ||||
|         return m_value.visit( | ||||
|             [](StringView view) { return view; }, | ||||
|             [](FlyString const& identifier) { return identifier.view(); }, | ||||
|             [](DeprecatedFlyString const& identifier) { return identifier.view(); }, | ||||
|             [](Empty) -> StringView { VERIFY_NOT_REACHED(); }); | ||||
|     } | ||||
| 
 | ||||
|     FlyString flystring_value() const | ||||
|     DeprecatedFlyString DeprecatedFlyString_value() const | ||||
|     { | ||||
|         return m_value.visit( | ||||
|             [](StringView view) -> FlyString { return view; }, | ||||
|             [](FlyString const& identifier) -> FlyString { return identifier; }, | ||||
|             [](Empty) -> FlyString { VERIFY_NOT_REACHED(); }); | ||||
|             [](StringView view) -> DeprecatedFlyString { return view; }, | ||||
|             [](DeprecatedFlyString const& identifier) -> DeprecatedFlyString { return identifier; }, | ||||
|             [](Empty) -> DeprecatedFlyString { VERIFY_NOT_REACHED(); }); | ||||
|     } | ||||
| 
 | ||||
|     StringView filename() const { return m_filename; } | ||||
|  | @ -236,7 +236,7 @@ public: | |||
|     DeprecatedString string_value(StringValueStatus& status) const; | ||||
|     DeprecatedString raw_template_value() const; | ||||
| 
 | ||||
|     void set_identifier_value(FlyString value) | ||||
|     void set_identifier_value(DeprecatedFlyString value) | ||||
|     { | ||||
|         m_value = move(value); | ||||
|     } | ||||
|  | @ -249,7 +249,7 @@ private: | |||
|     DeprecatedString m_message; | ||||
|     StringView m_trivia; | ||||
|     StringView m_original_value; | ||||
|     Variant<Empty, StringView, FlyString> m_value {}; | ||||
|     Variant<Empty, StringView, DeprecatedFlyString> m_value {}; | ||||
|     StringView m_filename; | ||||
|     size_t m_line_number { 0 }; | ||||
|     size_t m_line_column { 0 }; | ||||
|  |  | |||
|  | @ -16,7 +16,7 @@ namespace PDF { | |||
| ENUMERATE_COLOR_SPACE_FAMILIES(ENUMERATE); | ||||
| #undef ENUMERATE | ||||
| 
 | ||||
| PDFErrorOr<ColorSpaceFamily> ColorSpaceFamily::get(FlyString const& family_name) | ||||
| PDFErrorOr<ColorSpaceFamily> ColorSpaceFamily::get(DeprecatedFlyString const& family_name) | ||||
| { | ||||
| #define ENUMERATE(f_name, ever_needs_parameters) \ | ||||
|     if (family_name == f_name.name()) {          \ | ||||
|  | @ -27,7 +27,7 @@ PDFErrorOr<ColorSpaceFamily> ColorSpaceFamily::get(FlyString const& family_name) | |||
|     return Error(Error::Type::MalformedPDF, DeprecatedString::formatted("Unknown ColorSpace family {}", family_name)); | ||||
| } | ||||
| 
 | ||||
| PDFErrorOr<NonnullRefPtr<ColorSpace>> ColorSpace::create(FlyString const& name) | ||||
| PDFErrorOr<NonnullRefPtr<ColorSpace>> ColorSpace::create(DeprecatedFlyString const& name) | ||||
| { | ||||
|     // Simple color spaces with no parameters, which can be specified directly
 | ||||
|     if (name == CommonNames::DeviceGray) | ||||
|  | @ -305,7 +305,7 @@ PDFErrorOr<NonnullRefPtr<ColorSpace>> ICCBasedColorSpace::create(Document* docum | |||
| 
 | ||||
|     auto dict = param.get<NonnullRefPtr<Object>>()->cast<StreamObject>()->dict(); | ||||
| 
 | ||||
|     FlyString name; | ||||
|     DeprecatedFlyString name; | ||||
|     if (!dict->contains(CommonNames::Alternate)) { | ||||
|         auto number_of_components = dict->get_value(CommonNames::N).to_int(); | ||||
|         if (number_of_components == 1) | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Forward.h> | ||||
| #include <LibGfx/Color.h> | ||||
| #include <LibPDF/Value.h> | ||||
|  | @ -28,28 +28,28 @@ namespace PDF { | |||
| 
 | ||||
| class ColorSpaceFamily { | ||||
| public: | ||||
|     ColorSpaceFamily(FlyString name, bool never_needs_paramaters_p) | ||||
|     ColorSpaceFamily(DeprecatedFlyString name, bool never_needs_paramaters_p) | ||||
|         : m_name(move(name)) | ||||
|         , m_never_needs_parameters(never_needs_paramaters_p) | ||||
|     { | ||||
|     } | ||||
| 
 | ||||
|     FlyString name() const { return m_name; }; | ||||
|     DeprecatedFlyString name() const { return m_name; }; | ||||
|     bool never_needs_parameters() const { return m_never_needs_parameters; }; | ||||
|     static PDFErrorOr<ColorSpaceFamily> get(FlyString const&); | ||||
|     static PDFErrorOr<ColorSpaceFamily> get(DeprecatedFlyString const&); | ||||
| 
 | ||||
| #define ENUMERATE(name, ever_needs_parameters) static ColorSpaceFamily name; | ||||
|     ENUMERATE_COLOR_SPACE_FAMILIES(ENUMERATE) | ||||
| #undef ENUMERATE | ||||
| 
 | ||||
| private: | ||||
|     FlyString m_name; | ||||
|     DeprecatedFlyString m_name; | ||||
|     bool m_never_needs_parameters; | ||||
| }; | ||||
| 
 | ||||
| class ColorSpace : public RefCounted<ColorSpace> { | ||||
| public: | ||||
|     static PDFErrorOr<NonnullRefPtr<ColorSpace>> create(FlyString const&); | ||||
|     static PDFErrorOr<NonnullRefPtr<ColorSpace>> create(DeprecatedFlyString const&); | ||||
|     static PDFErrorOr<NonnullRefPtr<ColorSpace>> create(Document*, NonnullRefPtr<ArrayObject>); | ||||
| 
 | ||||
|     virtual ~ColorSpace() = default; | ||||
|  |  | |||
|  | @ -8,10 +8,10 @@ | |||
| 
 | ||||
| namespace PDF { | ||||
| 
 | ||||
| #define ENUMERATE(name) FlyString CommonNames::name = #name; | ||||
| #define ENUMERATE(name) DeprecatedFlyString CommonNames::name = #name; | ||||
| ENUMERATE_COMMON_NAMES(ENUMERATE) | ||||
| #undef ENUMERATE | ||||
| 
 | ||||
| FlyString CommonNames::IdentityH = "Identity-H"; | ||||
| DeprecatedFlyString CommonNames::IdentityH = "Identity-H"; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| 
 | ||||
| #define ENUMERATE_COMMON_NAMES(A) \ | ||||
|     A(AIS)                        \ | ||||
|  | @ -150,11 +150,11 @@ namespace PDF { | |||
| 
 | ||||
| class CommonNames { | ||||
| public: | ||||
| #define ENUMERATE(name) static FlyString name; | ||||
| #define ENUMERATE(name) static DeprecatedFlyString name; | ||||
|     ENUMERATE_COMMON_NAMES(ENUMERATE) | ||||
| #undef ENUMERATE | ||||
| 
 | ||||
|     static FlyString IdentityH; | ||||
|     static DeprecatedFlyString IdentityH; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -199,7 +199,7 @@ PDFErrorOr<void> Document::add_page_tree_node_to_page_tree(NonnullRefPtr<DictObj | |||
|     return {}; | ||||
| } | ||||
| 
 | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree(NonnullRefPtr<DictObject> tree, FlyString name) | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree(NonnullRefPtr<DictObject> tree, DeprecatedFlyString name) | ||||
| { | ||||
|     if (tree->contains(CommonNames::Kids)) { | ||||
|         return find_in_name_tree_nodes(tree->get_array(CommonNames::Kids), name); | ||||
|  | @ -210,7 +210,7 @@ PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree(NonnullRefPtr<Dict | |||
|     return find_in_key_value_array(key_value_names_array, name); | ||||
| } | ||||
| 
 | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree_nodes(NonnullRefPtr<ArrayObject> siblings, FlyString name) | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree_nodes(NonnullRefPtr<ArrayObject> siblings, DeprecatedFlyString name) | ||||
| { | ||||
|     for (size_t i = 0; i < siblings->size(); i++) { | ||||
|         auto sibling = TRY(resolve_to<DictObject>(siblings->at(i))); | ||||
|  | @ -226,7 +226,7 @@ PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_name_tree_nodes(NonnullRefPt | |||
|     return Error { Error::Type::MalformedPDF, DeprecatedString::formatted("Didn't find node in name tree containing name {}", name) }; | ||||
| } | ||||
| 
 | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_key_value_array(NonnullRefPtr<ArrayObject> key_value_array, FlyString name) | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::find_in_key_value_array(NonnullRefPtr<ArrayObject> key_value_array, DeprecatedFlyString name) | ||||
| { | ||||
|     if (key_value_array->size() % 2 == 1) | ||||
|         return Error { Error::Type::MalformedPDF, "key/value array has dangling key" }; | ||||
|  | @ -306,7 +306,7 @@ PDFErrorOr<Destination> Document::create_destination_from_parameters(NonnullRefP | |||
|     return Destination { type, page_number_by_index_ref.get(page_ref.as_ref_index()), parameters }; | ||||
| } | ||||
| 
 | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::get_inheritable_object(FlyString const& name, NonnullRefPtr<DictObject> object) | ||||
| PDFErrorOr<NonnullRefPtr<Object>> Document::get_inheritable_object(DeprecatedFlyString const& name, NonnullRefPtr<DictObject> object) | ||||
| { | ||||
|     if (!object->contains(name)) { | ||||
|         auto parent = TRY(object->get_dict(this, CommonNames::Parent)); | ||||
|  | @ -352,7 +352,7 @@ PDFErrorOr<NonnullRefPtr<OutlineItem>> Document::build_outline_item(NonnullRefPt | |||
|             auto dest_arr = dest_obj->cast<ArrayObject>(); | ||||
|             outline_item->dest = TRY(create_destination_from_parameters(dest_arr, page_number_by_index_ref)); | ||||
|         } else if (dest_obj->is<NameObject>() || dest_obj->is<StringObject>()) { | ||||
|             FlyString dest_name; | ||||
|             DeprecatedFlyString dest_name; | ||||
|             if (dest_obj->is<NameObject>()) | ||||
|                 dest_name = dest_obj->cast<NameObject>()->name(); | ||||
|             else | ||||
|  |  | |||
|  | @ -138,11 +138,11 @@ private: | |||
|     PDFErrorOr<Destination> create_destination_from_parameters(NonnullRefPtr<ArrayObject>, HashMap<u32, u32> const&); | ||||
|     PDFErrorOr<Destination> create_destination_from_dictionary_entry(NonnullRefPtr<Object> const& entry, HashMap<u32, u32> const& page_number_by_index_ref); | ||||
| 
 | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> get_inheritable_object(FlyString const& name, NonnullRefPtr<DictObject>); | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> get_inheritable_object(DeprecatedFlyString const& name, NonnullRefPtr<DictObject>); | ||||
| 
 | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> find_in_name_tree(NonnullRefPtr<DictObject> root, FlyString name); | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> find_in_name_tree_nodes(NonnullRefPtr<ArrayObject> siblings, FlyString name); | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> find_in_key_value_array(NonnullRefPtr<ArrayObject> key_value_array, FlyString name); | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> find_in_name_tree(NonnullRefPtr<DictObject> root, DeprecatedFlyString name); | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> find_in_name_tree_nodes(NonnullRefPtr<ArrayObject> siblings, DeprecatedFlyString name); | ||||
|     PDFErrorOr<NonnullRefPtr<Object>> find_in_key_value_array(NonnullRefPtr<ArrayObject> key_value_array, DeprecatedFlyString name); | ||||
| 
 | ||||
|     NonnullRefPtr<DocumentParser> m_parser; | ||||
|     RefPtr<DictObject> m_catalog; | ||||
|  |  | |||
|  | @ -12,7 +12,7 @@ | |||
| 
 | ||||
| namespace PDF { | ||||
| 
 | ||||
| ErrorOr<ByteBuffer> Filter::decode(ReadonlyBytes bytes, FlyString const& encoding_type, RefPtr<DictObject> decode_parms) | ||||
| ErrorOr<ByteBuffer> Filter::decode(ReadonlyBytes bytes, DeprecatedFlyString const& encoding_type, RefPtr<DictObject> decode_parms) | ||||
| { | ||||
|     int predictor = 1; | ||||
|     int columns = 1; | ||||
|  |  | |||
|  | @ -7,15 +7,15 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/ByteBuffer.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Error.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <LibPDF/ObjectDerivatives.h> | ||||
| 
 | ||||
| namespace PDF { | ||||
| 
 | ||||
| class Filter { | ||||
| public: | ||||
|     static ErrorOr<ByteBuffer> decode(ReadonlyBytes bytes, FlyString const& encoding_type, RefPtr<DictObject> decode_parms); | ||||
|     static ErrorOr<ByteBuffer> decode(ReadonlyBytes bytes, DeprecatedFlyString const& encoding_type, RefPtr<DictObject> decode_parms); | ||||
| 
 | ||||
| private: | ||||
|     static ErrorOr<ByteBuffer> decode_ascii_hex(ReadonlyBytes bytes); | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| 
 | ||||
| namespace PDF { | ||||
| 
 | ||||
| static bool is_standard_latin_font(FlyString const& font) | ||||
| static bool is_standard_latin_font(DeprecatedFlyString const& font) | ||||
| { | ||||
|     return font.is_one_of( | ||||
|         "Times-Roman", "TimesNewRoman", | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| #pragma once | ||||
| 
 | ||||
| #include <AK/Debug.h> | ||||
| #include <AK/FlyString.h> | ||||
| #include <AK/DeprecatedFlyString.h> | ||||
| #include <AK/Format.h> | ||||
| #include <AK/RefCounted.h> | ||||
| #include <AK/SourceLocation.h> | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ PDFErrorOr<NonnullRefPtr<Object>> ArrayObject::get_object_at(Document* document, | |||
|     return document->resolve_to<Object>(at(index)); | ||||
| } | ||||
| 
 | ||||
| PDFErrorOr<NonnullRefPtr<Object>> DictObject::get_object(Document* document, FlyString const& key) const | ||||
| PDFErrorOr<NonnullRefPtr<Object>> DictObject::get_object(Document* document, DeprecatedFlyString const& key) const | ||||
| { | ||||
|     return document->resolve_to<Object>(get_value(key)); | ||||
| } | ||||
|  | @ -34,12 +34,12 @@ PDFErrorOr<NonnullRefPtr<Object>> DictObject::get_object(Document* document, Fly | |||
|         return cast_to<class_name>(m_elements[index]);                                                                           \ | ||||
|     }                                                                                                                            \ | ||||
|                                                                                                                                  \ | ||||
|     PDFErrorOr<NonnullRefPtr<class_name>> DictObject::get_##snake_name(Document* document, FlyString const& key) const \ | ||||
|     PDFErrorOr<NonnullRefPtr<class_name>> DictObject::get_##snake_name(Document* document, DeprecatedFlyString const& key) const \ | ||||
|     {                                                                                                                            \ | ||||
|         return document->resolve_to<class_name>(get_value(key));                                                                 \ | ||||
|     }                                                                                                                            \ | ||||
|                                                                                                                                  \ | ||||
|     NonnullRefPtr<class_name> DictObject::get_##snake_name(FlyString const& key) const                                 \ | ||||
|     NonnullRefPtr<class_name> DictObject::get_##snake_name(DeprecatedFlyString const& key) const                                 \ | ||||
|     {                                                                                                                            \ | ||||
|         return cast_to<class_name>(get_value(key));                                                                              \ | ||||
|     } | ||||
|  |  | |||
Some files were not shown because too many files have changed in this diff Show more
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy Flynn
						Timothy Flynn