1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:07:46 +00:00

LibJS: Replace uses of MarkedValueList with MarkedVector<Value>

This is effectively a drop-in replacement.
This commit is contained in:
Linus Groh 2022-02-09 10:06:40 +00:00
parent 1d32ac7b8b
commit bc183dbbcb
61 changed files with 143 additions and 142 deletions

View file

@ -38,7 +38,7 @@ static Optional<OptionType> to_option_type(Value value)
}
// 13.1 IterableToListOfType ( items, elementTypes ), https://tc39.es/proposal-temporal/#sec-iterabletolistoftype
ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject& global_object, Value items, Vector<OptionType> const& element_types)
ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(GlobalObject& global_object, Value items, Vector<OptionType> const& element_types)
{
auto& vm = global_object.vm();
auto& heap = global_object.heap();
@ -47,7 +47,7 @@ ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject& global
auto iterator_record = TRY(get_iterator(global_object, items, IteratorHint::Sync));
// 2. Let values be a new empty List.
MarkedValueList values(heap);
MarkedVector<Value> values(heap);
// 3. Let next be true.
auto next = true;

View file

@ -97,7 +97,7 @@ struct SecondsStringPrecision {
u32 increment;
};
ThrowCompletionOr<MarkedValueList> iterable_to_list_of_type(GlobalObject&, Value items, Vector<OptionType> const& element_types);
ThrowCompletionOr<MarkedVector<Value>> iterable_to_list_of_type(GlobalObject&, Value items, Vector<OptionType> const& element_types);
ThrowCompletionOr<Object*> get_options_object(GlobalObject&, Value options);
ThrowCompletionOr<Value> get_option(GlobalObject&, Object const& options, PropertyKey const& property, Vector<OptionType> const& types, Vector<StringView> const& values, Value fallback);
template<typename NumberType>

View file

@ -89,7 +89,7 @@ ThrowCompletionOr<Vector<String>> calendar_fields(GlobalObject& global_object, O
auto fields = TRY(Value(&calendar).get_method(global_object, vm.names.fields));
// 2. Let fieldsArray be ! CreateArrayFromList(fieldNames).
auto field_names_values = MarkedValueList { vm.heap() };
auto field_names_values = MarkedVector<Value> { vm.heap() };
for (auto& field_name : field_names)
field_names_values.append(js_string(vm, field_name));
Value fields_array = Array::create_from(global_object, field_names_values);

View file

@ -489,7 +489,7 @@ JS_DEFINE_NATIVE_FUNCTION(CalendarPrototype::fields)
auto iterator_record = TRY(get_iterator(global_object, fields, IteratorHint::Sync));
// 5. Let fieldNames be a new empty List.
auto field_names = MarkedValueList { vm.heap() };
auto field_names = MarkedVector<Value> { vm.heap() };
// 6. Let next be true.
// 7. Repeat, while next is not false,

View file

@ -8,7 +8,6 @@
#include <AK/Optional.h>
#include <LibJS/Heap/MarkedVector.h>
#include <LibJS/Runtime/MarkedValueList.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/Temporal/AbstractOperations.h>

View file

@ -151,7 +151,7 @@ JS_DEFINE_NATIVE_FUNCTION(TimeZonePrototype::get_possible_instants_for)
auto possible_epoch_nanoseconds = get_iana_time_zone_epoch_value(global_object, time_zone->identifier(), date_time->iso_year(), date_time->iso_month(), date_time->iso_day(), date_time->iso_hour(), date_time->iso_minute(), date_time->iso_second(), date_time->iso_millisecond(), date_time->iso_microsecond(), date_time->iso_nanosecond());
// 6. Let possibleInstants be a new empty List.
auto possible_instants = MarkedValueList { vm.heap() };
auto possible_instants = MarkedVector<Value> { vm.heap() };
// 7. For each value epochNanoseconds in possibleEpochNanoseconds, do
for (auto& epoch_nanoseconds : possible_epoch_nanoseconds) {