Explorar o código

AK: Remove `must_set()` from `JsonArray`

Due to 582c55a, both `must_set()` and `set()` should be providing the
same behavior. Not only is that a reason to remove `must_set()`, but
it also performs erroneous behavior since it inserts an element at
a specified index instead of modifying an element at that index.
Kemal Zebari %!s(int64=2) %!d(string=hai) anos
pai
achega
eda2a2f5da
Modificáronse 2 ficheiros con 1 adicións e 2 borrados
  1. 0 1
      AK/JsonArray.h
  2. 1 1
      Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp

+ 0 - 1
AK/JsonArray.h

@@ -62,7 +62,6 @@ public:
     [[nodiscard]] JsonValue take(size_t index) { return m_values.take(index); }
 
     void must_append(JsonValue value) { m_values.append(move(value)); }
-    void must_set(size_t index, JsonValue value) { m_values.insert(index, move(value)); }
 
     void clear() { m_values.clear(); }
     ErrorOr<void> append(JsonValue value) { return m_values.try_append(move(value)); }

+ 1 - 1
Userland/Libraries/LibWeb/WebDriver/ExecuteScript.cpp

@@ -203,7 +203,7 @@ static ErrorOr<JsonValue, ExecuteScriptResultType> clone_an_object(JS::Realm& re
                 [&](JsonArray& array) {
                     // NOTE: If this was a JS array, only indexed properties would be serialized anyway.
                     if (name.is_number())
-                        array.must_set(name.as_number(), cloned_property_result.value());
+                        array.set(name.as_number(), cloned_property_result.value());
                 },
                 [&](JsonObject& object) {
                     object.set(name.to_string(), cloned_property_result.value());