LibJS: Do not store iterated values in a plain vector

This commit is contained in:
Timothy Flynn 2024-10-31 12:32:23 -04:00 committed by Alexander Kalenik
parent 9949173fce
commit 108b4e7c15
Notes: github-actions[bot] 2024-10-31 23:36:59 +00:00

View file

@ -717,7 +717,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::to_array)
auto iterated = TRY(get_iterator_direct(vm, object));
// 4. Let items be a new empty List.
Vector<Value> items;
MarkedVector<Value> items(realm.heap());
// 5. Repeat,
while (true) {
@ -729,7 +729,7 @@ JS_DEFINE_NATIVE_FUNCTION(IteratorPrototype::to_array)
return Array::create_from(realm, items);
// c. Append value to items.
TRY_OR_THROW_OOM(vm, items.try_append(*value));
items.append(*value);
}
}