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
commit 0ba81dc0b7
Notes: sideshowbarker 2024-07-18 10:18:06 +09:00
8 changed files with 8 additions and 11 deletions

View file

@ -1810,7 +1810,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
return {};
if (property.type() == ObjectProperty::Type::Spread) {
if (key.is_object() && key.as_object().is_array()) {
if (key.is_object() && is<Array>(key.as_object())) {
auto& array_to_spread = static_cast<Array&>(key.as_object());
for (auto& entry : array_to_spread.indexed_properties()) {
auto value = array_to_spread.get(entry.index());