mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 18:07:35 +00:00
LibJS: Remove the non-standard put helper and replace it's usages
This removes all usages of the non-standard put helper method and replaces all of it's usages with the specification required alternative or with define_direct_property where appropriate.
This commit is contained in:
parent
53f70e5208
commit
e3ef241108
15 changed files with 40 additions and 49 deletions
|
@ -265,8 +265,8 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
|
|||
return JS::js_undefined();
|
||||
|
||||
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));
|
||||
object->define_direct_property("column", JS::js_string(vm, sheet_object->m_sheet.column(position.value().column)), JS::default_attributes);
|
||||
object->define_direct_property("row", JS::Value((unsigned)position.value().row), JS::default_attributes);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
@ -295,8 +295,8 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::current_cell_position)
|
|||
auto position = current_cell->position();
|
||||
|
||||
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));
|
||||
object->define_direct_property("column", JS::js_string(vm, sheet_object->m_sheet.column(position.column)), JS::default_attributes);
|
||||
object->define_direct_property("row", JS::Value((unsigned)position.row), JS::default_attributes);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ Sheet::Sheet(Workbook& workbook)
|
|||
JS::DeferGC defer_gc(m_workbook.interpreter().heap());
|
||||
m_global_object = m_workbook.interpreter().heap().allocate_without_global_object<SheetGlobalObject>(*this);
|
||||
global_object().initialize_global_object();
|
||||
global_object().put("workbook", m_workbook.workbook_object());
|
||||
global_object().put("thisSheet", &global_object()); // Self-reference is unfortunate, but required.
|
||||
global_object().define_direct_property("workbook", m_workbook.workbook_object(), JS::default_attributes);
|
||||
global_object().define_direct_property("thisSheet", &global_object(), JS::default_attributes); // Self-reference is unfortunate, but required.
|
||||
|
||||
// Sadly, these have to be evaluated once per sheet.
|
||||
auto file_or_error = Core::File::open("/res/js/Spreadsheet/runtime.js", Core::OpenMode::ReadOnly);
|
||||
|
|
|
@ -38,7 +38,7 @@ Workbook::Workbook(NonnullRefPtrVector<Sheet>&& sheets)
|
|||
, m_interpreter_scope(JS::VM::InterpreterExecutionScope(interpreter()))
|
||||
{
|
||||
m_workbook_object = interpreter().heap().allocate<WorkbookObject>(global_object(), *this);
|
||||
global_object().put("workbook", workbook_object());
|
||||
global_object().define_direct_property("workbook", workbook_object(), JS::default_attributes);
|
||||
}
|
||||
|
||||
bool Workbook::set_filename(const String& filename)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue