mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 01:25:09 +00:00
LibJS: Replace Object's create_empty() with create() taking a prototype
This now matches the spec's OrdinaryObjectCreate() across the board: instead of implicitly setting the created object's prototype to %Object.prototype% and then in many cases setting it to a nullptr right away, it now has an 'Object* prototype' parameter with _no default value_. This makes the code easier to compare with the spec, very clear in terms of what prototype is being used as well as avoiding unnecessary shape transitions. Also fixes a couple of cases were we weren't setting the correct prototype. There's no reason to assume that the object would not be empty (as in having own properties), so let's follow our existing pattern of Type::create(...) and simply call it 'create'.
This commit is contained in:
parent
7489189645
commit
317b88a8c3
14 changed files with 42 additions and 35 deletions
|
@ -362,8 +362,7 @@ void WebAssemblyInstanceObject::initialize(JS::GlobalObject& global_object)
|
|||
Object::initialize(global_object);
|
||||
|
||||
VERIFY(!m_exports_object);
|
||||
m_exports_object = JS::Object::create_empty(global_object);
|
||||
m_exports_object->set_prototype(nullptr);
|
||||
m_exports_object = JS::Object::create(global_object, nullptr);
|
||||
auto& instance = this->instance();
|
||||
for (auto& export_ : instance.exports()) {
|
||||
export_.value().visit(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue