mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
LibJS: Implement the object literal __proto__ property key special case
This commit is contained in:
parent
9fa78b1a05
commit
7ebb421ee9
4 changed files with 22 additions and 0 deletions
|
@ -2994,6 +2994,17 @@ Completion ObjectExpression::execute(Interpreter& interpreter, GlobalObject& glo
|
|||
|
||||
auto value = TRY(property.value().execute(interpreter, global_object)).release_value();
|
||||
|
||||
// 8. If isProtoSetter is true, then
|
||||
if (property.type() == ObjectProperty::Type::ProtoSetter) {
|
||||
// a. If Type(propValue) is either Object or Null, then
|
||||
if (value.is_object() || value.is_null()) {
|
||||
// i. Perform ! object.[[SetPrototypeOf]](propValue).
|
||||
MUST(object->internal_set_prototype_of(value.is_object() ? &value.as_object() : nullptr));
|
||||
}
|
||||
// b. Return unused.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (value.is_function() && property.is_method())
|
||||
static_cast<ECMAScriptFunctionObject&>(value.as_function()).set_home_object(object);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue