diff options
author | Andreas Kling <kling@serenityos.org> | 2020-09-08 14:15:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-09-08 14:15:13 +0200 |
commit | d85eed585ca9235ce704702bf897f9307484d774 (patch) | |
tree | 62bd862b3a9574f7c7b7dce04581f6b3a1ec8178 /Libraries/LibJS/AST.cpp | |
parent | b4bfc3ed54dbddfb90e5956e7829b4e282842848 (diff) | |
download | serenity-d85eed585ca9235ce704702bf897f9307484d774.zip |
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.
Diffstat (limited to 'Libraries/LibJS/AST.cpp')
-rw-r--r-- | Libraries/LibJS/AST.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Libraries/LibJS/AST.cpp b/Libraries/LibJS/AST.cpp index 70e1992a79..bd7fa5ee38 100644 --- a/Libraries/LibJS/AST.cpp +++ b/Libraries/LibJS/AST.cpp @@ -163,7 +163,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj if (interpreter.exception()) return {}; if (m_arguments[i].is_spread) { - get_iterator_values(global_object, value, [&](Value& iterator_value) { + get_iterator_values(global_object, value, [&](Value iterator_value) { if (interpreter.exception()) return IterationDecision::Break; arguments.append(iterator_value); @@ -419,7 +419,7 @@ Value ForOfStatement::execute(Interpreter& interpreter, GlobalObject& global_obj if (interpreter.exception()) return {}; - get_iterator_values(global_object, rhs_result, [&](Value& value) { + get_iterator_values(global_object, rhs_result, [&](Value value) { interpreter.set_variable(variable_name, value, global_object); last_value = interpreter.run(global_object, *m_body); if (interpreter.exception()) @@ -1652,7 +1652,7 @@ Value ArrayExpression::execute(Interpreter& interpreter, GlobalObject& global_ob return {}; if (element->is_spread_expression()) { - get_iterator_values(global_object, value, [&](Value& iterator_value) { + get_iterator_values(global_object, value, [&](Value iterator_value) { array->indexed_properties().append(iterator_value); return IterationDecision::Continue; }); |