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

LibJS: get_iterator_values() should pass Value to callback (not Value&)

Value& implies that the callback is expected/able to modify the value,
which is not the case.
This commit is contained in:
Andreas Kling 2020-09-08 14:15:13 +02:00
parent b4bfc3ed54
commit d85eed585c
4 changed files with 6 additions and 6 deletions

View file

@ -108,7 +108,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayConstructor::from)
array->set_indexed_property_elements(move(elements));
} else {
// * iterable objects
get_iterator_values(global_object, value, [&](Value& element) {
get_iterator_values(global_object, value, [&](Value element) {
if (interpreter.exception())
return IterationDecision::Break;
array->indexed_properties().append(element);

View file

@ -101,7 +101,7 @@ Value create_iterator_result_object(GlobalObject& global_object, Value value, bo
return object;
}
void get_iterator_values(GlobalObject& global_object, Value value, AK::Function<IterationDecision(Value&)> callback)
void get_iterator_values(GlobalObject& global_object, Value value, AK::Function<IterationDecision(Value)> callback)
{
auto& interpreter = global_object.interpreter();

View file

@ -41,6 +41,6 @@ Value create_iterator_result_object(GlobalObject&, Value value, bool done);
Object* iterator_next(Object& iterator, Value value = {});
void iterator_close(Object& iterator);
void get_iterator_values(GlobalObject&, Value value, AK::Function<IterationDecision(Value&)> callback);
void get_iterator_values(GlobalObject&, Value value, AK::Function<IterationDecision(Value)> callback);
}