mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:57:44 +00:00
LibJS: Remove Object::value_of()
Being really close to Object.prototype.valueOf() name wise makes this unnecessarily confusing - while it sometimes serves as the implementation of a valueOf() function, it's an abstraction which the spec doesn't have. Use the appropriate getters to retrieve specific internal slots instead, most commonly [[FooData]] from the primitive wrapper objects. For the Object class specifically, use the Value(Object*) ctor instead.
This commit is contained in:
parent
07c5419a82
commit
038d354b5d
14 changed files with 20 additions and 38 deletions
|
@ -73,9 +73,13 @@ public:
|
|||
String locale_string() const { return m_datetime.to_string(); }
|
||||
String locale_time_string() const { return m_datetime.to_string("%H:%M:%S"); }
|
||||
|
||||
virtual Value value_of() const override
|
||||
// https://tc39.es/ecma262/#sec-properties-of-date-instances
|
||||
// [[DateValue]]
|
||||
double date_value() const
|
||||
{
|
||||
return Value(static_cast<double>(m_datetime.timestamp() * 1000 + m_milliseconds));
|
||||
return m_is_invalid
|
||||
? NAN
|
||||
: static_cast<double>(m_datetime.timestamp() * 1000 + m_milliseconds);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue