LibJS: Simplify a Value type check in Object::to_string()

This commit is contained in:
Andreas Kling 2020-05-06 16:40:08 +02:00
parent a82419469f
commit 025cdfdce8

View file

@ -477,7 +477,7 @@ Value Object::to_primitive(PreferredType preferred_type) const
Value Object::to_string() const
{
auto to_string_property = get("toString");
if (!to_string_property.is_empty() && to_string_property.is_function()) {
if (to_string_property.is_function()) {
auto& to_string_function = to_string_property.as_function();
auto& interpreter = const_cast<Object*>(this)->interpreter();
auto to_string_result = interpreter.call(to_string_function, const_cast<Object*>(this));