summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet/JSIntegration.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-06-16 20:52:30 +0100
committerLinus Groh <mail@linusgroh.de>2021-06-16 22:49:04 +0100
commit317b88a8c395bf34b0290eaddeefb6afe4b584ed (patch)
tree31c692bd8f27a30325f6367264f0eb153e3e4fac /Userland/Applications/Spreadsheet/JSIntegration.cpp
parent748918964592b2fb560ce08de47779b6d5db30da (diff)
downloadserenity-317b88a8c395bf34b0290eaddeefb6afe4b584ed.zip
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'.
Diffstat (limited to 'Userland/Applications/Spreadsheet/JSIntegration.cpp')
-rw-r--r--Userland/Applications/Spreadsheet/JSIntegration.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp
index 8c87c6ac25..e13cc28c2e 100644
--- a/Userland/Applications/Spreadsheet/JSIntegration.cpp
+++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp
@@ -263,7 +263,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
if (!position.has_value())
return JS::js_undefined();
- auto object = JS::Object::create_empty(global_object);
+ auto object = JS::Object::create(global_object, global_object.object_prototype());
object->put("column", JS::js_string(vm, sheet_object->m_sheet.column(position.value().column)));
object->put("row", JS::Value((unsigned)position.value().row));
@@ -293,7 +293,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::current_cell_position)
auto position = current_cell->position();
- auto object = JS::Object::create_empty(global_object);
+ auto object = JS::Object::create(global_object, global_object.object_prototype());
object->put("column", JS::js_string(vm, sheet_object->m_sheet.column(position.column)));
object->put("row", JS::Value((unsigned)position.row));
@@ -377,7 +377,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic)
}
WorkbookObject::WorkbookObject(Workbook& workbook)
- : JS::Object(*JS::Object::create_empty(workbook.global_object()))
+ : JS::Object(*JS::Object::create(workbook.global_object(), workbook.global_object().object_prototype()))
, m_workbook(workbook)
{
}