mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 22:55:23 +00:00
LibJS: Use element index as key for array spread in object
This fixes spreading of arrays with holes in object literals where the inserted keys are not consecutive numbers. Fixes #3967.
This commit is contained in:
committed by
Andreas Kling
parent
06a3625545
commit
745ffca580
@@ -1552,7 +1552,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
||||
if (key.is_array()) {
|
||||
auto& array_to_spread = static_cast<Array&>(key.as_object());
|
||||
for (auto& entry : array_to_spread.indexed_properties()) {
|
||||
object->indexed_properties().append(entry.value_and_attributes(&array_to_spread).value);
|
||||
object->indexed_properties().put(object, entry.index(), entry.value_and_attributes(&array_to_spread).value);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user