diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-20 09:48:43 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | 999da617c5a59f2c8bc8b199c69014ee04668ee1 (patch) | |
tree | 501d5e7ea375319fa8fb8f4385f6fecd6f76c338 /Userland/Applications | |
parent | f3117d46dc872a2d0f57273293b5691777b06279 (diff) | |
download | serenity-999da617c5a59f2c8bc8b199c69014ee04668ee1.zip |
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.
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/Spreadsheet/JSIntegration.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Userland/Applications/Spreadsheet/JSIntegration.cpp b/Userland/Applications/Spreadsheet/JSIntegration.cpp index 3f1ed4cd1b..083a58fb26 100644 --- a/Userland/Applications/Spreadsheet/JSIntegration.cpp +++ b/Userland/Applications/Spreadsheet/JSIntegration.cpp @@ -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"); |