mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Have JsonArray::set() change values instead of inserting values
Resolves #18618.
8134dcc changed `JsonArray::set()` to insert elements at an index
instead of changing existing elements in-place. Since no behavior
such as `Vector::try_at()` exists yet, it returns nothing.
This commit is contained in:
@@ -66,7 +66,7 @@ public:
|
|||||||
|
|
||||||
void clear() { m_values.clear(); }
|
void clear() { m_values.clear(); }
|
||||||
ErrorOr<void> append(JsonValue value) { return m_values.try_append(move(value)); }
|
ErrorOr<void> append(JsonValue value) { return m_values.try_append(move(value)); }
|
||||||
ErrorOr<void> set(size_t index, JsonValue value) { return m_values.try_insert(index, move(value)); }
|
void set(size_t index, JsonValue value) { m_values.at(index) = move(value); }
|
||||||
|
|
||||||
template<typename Builder>
|
template<typename Builder>
|
||||||
typename Builder::OutputType serialized() const;
|
typename Builder::OutputType serialized() const;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ ErrorOr<void> JsonArrayModel::set(int row, Vector<JsonValue>&& fields)
|
|||||||
obj.set(field_spec.json_field_name, move(fields.at(i)));
|
obj.set(field_spec.json_field_name, move(fields.at(i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TRY(m_array.set(row, move(obj)));
|
m_array.set(row, move(obj));
|
||||||
did_update();
|
did_update();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
Reference in New Issue
Block a user