mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 19:57:44 +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
|
@ -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; }
|
||||
|
@ -127,9 +127,9 @@ private:
|
|||
return m_type == Type::Empty;
|
||||
}
|
||||
|
||||
Type m_type { Type::Normal }; // [[Type]]
|
||||
Optional<Value> m_value; // [[Value]]
|
||||
Optional<FlyString> m_target; // [[Target]]
|
||||
Type m_type { Type::Normal }; // [[Type]]
|
||||
Optional<Value> m_value; // [[Value]]
|
||||
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]]
|
||||
Module* m_module; // [[Module]]
|
||||
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,20 +20,20 @@ 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]]
|
||||
Vector<Assertion> assertions; // [[Assertions]]
|
||||
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; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue