mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 08:44:58 +00:00
AK: Fix JsonValue copy constructor behavior for 64-bit values
The fact that JsonValues can contain 64-bit values isn't a JavaScript compatible behavior in the first place, but as long as we're supporting this, we should make sure it works correctly.
This commit is contained in:
parent
655f4daeb1
commit
ecd4c6718e
2 changed files with 11 additions and 3 deletions
|
@ -68,7 +68,7 @@ void JsonValue::copy_from(const JsonValue& other)
|
|||
m_value.as_array = new JsonArray(*other.m_value.as_array);
|
||||
break;
|
||||
default:
|
||||
m_value.as_string = other.m_value.as_string;
|
||||
m_value.as_u64 = other.m_value.as_u64;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void JsonValue::copy_from(const JsonValue& other)
|
|||
JsonValue::JsonValue(JsonValue&& other)
|
||||
{
|
||||
m_type = exchange(other.m_type, Type::Null);
|
||||
m_value.as_string = exchange(other.m_value.as_string, nullptr);
|
||||
m_value.as_u64 = exchange(other.m_value.as_u64, 0);
|
||||
}
|
||||
|
||||
JsonValue& JsonValue::operator=(JsonValue&& other)
|
||||
|
@ -84,7 +84,7 @@ JsonValue& JsonValue::operator=(JsonValue&& other)
|
|||
if (this != &other) {
|
||||
clear();
|
||||
m_type = exchange(other.m_type, Type::Null);
|
||||
m_value.as_string = exchange(other.m_value.as_string, nullptr);
|
||||
m_value.as_u64 = exchange(other.m_value.as_u64, 0);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue