1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:18:12 +00:00

LibJS: Remove Object::is_array() in favor of Value::is_array() and RTTI

It's way too easy to get this wrong: for the IsArray abstract operation,
Value::is_array() needs to be called. Since we have RTTI, the virtual
Object::is_array() method is not needed anymore - if we need to know
whether something is *actually* a JS::Array (we currently check in more
cases than we should, I think) and not a Proxy with an Array target, we
should do that in a way that doesn't look like an abstract operation.
This commit is contained in:
Linus Groh 2021-07-05 18:58:51 +01:00
parent 06ffc0c4db
commit 0ba81dc0b7
8 changed files with 8 additions and 11 deletions

View file

@ -61,7 +61,7 @@ void MarkupGenerator::value_to_html(Value value, StringBuilder& output_html, Has
if (value.is_object()) {
auto& object = value.as_object();
if (object.is_array())
if (is<Array>(object))
return array_to_html(static_cast<const Array&>(object), output_html, seen_objects);
output_html.append(wrap_string_in_style(object.class_name(), StyleType::ObjectType));
if (object.is_function())