mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 06:47:34 +00:00
LibJS+LibWeb: Pass prototype to Object constructor
Everyone who constructs an Object must now pass a prototype object when applicable. There's still a fair amount of code that passes something fetched from the Interpreter, but this brings us closer to being able to detach prototypes from Interpreter eventually.
This commit is contained in:
parent
f6d57c82f6
commit
bc1ece7f37
30 changed files with 60 additions and 28 deletions
|
@ -52,7 +52,7 @@ ObjectConstructor::~ObjectConstructor()
|
|||
|
||||
Value ObjectConstructor::call(Interpreter& interpreter)
|
||||
{
|
||||
return interpreter.heap().allocate<Object>();
|
||||
return Object::create_empty(interpreter, interpreter.global_object());
|
||||
}
|
||||
|
||||
Value ObjectConstructor::construct(Interpreter& interpreter)
|
||||
|
@ -109,7 +109,7 @@ Value ObjectConstructor::get_own_property_descriptor(Interpreter& interpreter)
|
|||
auto metadata = object.shape().lookup(interpreter.argument(1).to_string());
|
||||
if (!metadata.has_value())
|
||||
return js_undefined();
|
||||
auto* descriptor = interpreter.heap().allocate<Object>();
|
||||
auto* descriptor = Object::create_empty(interpreter, interpreter.global_object());
|
||||
descriptor->put("configurable", Value(!!(metadata.value().attributes & Attribute::Configurable)));
|
||||
descriptor->put("enumerable", Value(!!(metadata.value().attributes & Attribute::Enumerable)));
|
||||
descriptor->put("writable", Value(!!(metadata.value().attributes & Attribute::Writable)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue