mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 21:30:58 +00:00 
			
		
		
		
	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.
			
			
This commit is contained in:
		
							parent
							
								
									c7e08c3266
								
							
						
					
					
						commit
						eda2a2f5da
					
				
				
				Notes:
				
					sideshowbarker
				
				2024-07-17 07:20:57 +09:00 
				
			
			Author: https://github.com/kemzeb
Commit: eda2a2f5da
Pull-request: https://github.com/SerenityOS/serenity/pull/18734
			
					 2 changed files with 1 additions and 2 deletions
				
			
		|  | @ -62,7 +62,6 @@ public: | ||||||
|     [[nodiscard]] JsonValue take(size_t index) { return m_values.take(index); } |     [[nodiscard]] JsonValue take(size_t index) { return m_values.take(index); } | ||||||
| 
 | 
 | ||||||
|     void must_append(JsonValue value) { m_values.append(move(value)); } |     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(); } |     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)); } | ||||||
|  |  | ||||||
|  | @ -203,7 +203,7 @@ static ErrorOr<JsonValue, ExecuteScriptResultType> clone_an_object(JS::Realm& re | ||||||
|                 [&](JsonArray& array) { |                 [&](JsonArray& array) { | ||||||
|                     // NOTE: If this was a JS array, only indexed properties would be serialized anyway.
 |                     // NOTE: If this was a JS array, only indexed properties would be serialized anyway.
 | ||||||
|                     if (name.is_number()) |                     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) { |                 [&](JsonObject& object) { | ||||||
|                     object.set(name.to_string(), cloned_property_result.value()); |                     object.set(name.to_string(), cloned_property_result.value()); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kemal Zebari
						Kemal Zebari