mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:27:43 +00:00
LibJS: Remove GlobalObject from VM::this_value()
This is a continuation of the previous six commits. The global object is only needed to return it if the execution context stack is empty, but that doesn't seem like a useful thing to allow in the first place - if you're not currently executing JS, and the execution context stack is empty, there is no this value to retrieve.
This commit is contained in:
parent
f3117d46dc
commit
999da617c5
36 changed files with 208 additions and 206 deletions
|
@ -171,7 +171,7 @@ void SheetGlobalObject::visit_edges(Visitor& visitor)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_name)
|
||||
{
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -182,7 +182,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_name)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
||||
{
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -211,7 +211,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_real_cell_contents)
|
|||
|
||||
JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::set_real_cell_contents)
|
||||
{
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -242,7 +242,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::parse_cell_name)
|
|||
{
|
||||
auto& realm = *global_object.associated_realm();
|
||||
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -272,7 +272,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::current_cell_position)
|
|||
if (vm.argument_count() != 0)
|
||||
return vm.throw_completion<JS::TypeError>("Expected no arguments to current_cell_position()");
|
||||
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -302,7 +302,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_index)
|
|||
|
||||
auto& column_name_str = column_name.as_string().string();
|
||||
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -330,7 +330,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::column_arithmetic)
|
|||
auto offset = TRY(vm.argument(1).to_number(global_object));
|
||||
auto offset_number = static_cast<i32>(offset.as_double());
|
||||
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -354,7 +354,7 @@ JS_DEFINE_NATIVE_FUNCTION(SheetGlobalObject::get_column_bound)
|
|||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "String");
|
||||
|
||||
auto& column_name_str = column_name.as_string().string();
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<SheetGlobalObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "SheetGlobalObject");
|
||||
|
@ -396,7 +396,7 @@ JS_DEFINE_NATIVE_FUNCTION(WorkbookObject::sheet)
|
|||
if (!name_value.is_string() && !name_value.is_number())
|
||||
return vm.throw_completion<JS::TypeError>("Expected a String or Number argument to sheet()");
|
||||
|
||||
auto* this_object = TRY(vm.this_value(global_object).to_object(global_object));
|
||||
auto* this_object = TRY(vm.this_value().to_object(global_object));
|
||||
|
||||
if (!is<WorkbookObject>(this_object))
|
||||
return vm.throw_completion<JS::TypeError>(JS::ErrorType::NotAnObjectOfType, "WorkbookObject");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue