diff --git a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp index e4a873ba09..22e3479346 100644 --- a/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp +++ b/Userland/Libraries/LibJS/Bytecode/ASTCodegen.cpp @@ -936,7 +936,7 @@ Bytecode::CodeGenerationErrorOr ObjectExpression::generate_bytecode(Byteco Bytecode::Op::PropertyKind property_kind; switch (property->type()) { case ObjectProperty::Type::KeyValue: - property_kind = Bytecode::Op::PropertyKind::KeyValue; + property_kind = Bytecode::Op::PropertyKind::DirectKeyValue; break; case ObjectProperty::Type::Getter: property_kind = Bytecode::Op::PropertyKind::Getter; diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 2faed42f25..3b3773bab0 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -76,6 +76,9 @@ static ThrowCompletionOr put_by_property_key(VM& vm, Value base, Value thi return vm.throw_completion(ErrorType::ReferenceNullishSetProperty, name, TRY_OR_THROW_OOM(vm, base.to_string_without_side_effects())); break; } + case PropertyKind::DirectKeyValue: + object->define_direct_property(name, value, Attribute::Enumerable | Attribute::Writable | Attribute::Configurable); + break; case PropertyKind::Spread: TRY(object->copy_data_properties(vm, value, {})); break; diff --git a/Userland/Libraries/LibJS/Bytecode/Op.h b/Userland/Libraries/LibJS/Bytecode/Op.h index 0bb111d1ca..49c2ba580d 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.h +++ b/Userland/Libraries/LibJS/Bytecode/Op.h @@ -644,6 +644,7 @@ enum class PropertyKind { Getter, Setter, KeyValue, + DirectKeyValue, // Used for Object expressions. Always sets an own property, never calls a setter. Spread, ProtoSetter, };