diff options
author | Linus Groh <mail@linusgroh.de> | 2021-10-02 23:52:27 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-10-03 20:14:03 +0100 |
commit | b7e5f08e561696001d9b0ced8f3fe50caf186d2c (patch) | |
tree | debbec2ad0557cc166acc7f5777b023b44db080e /Userland/Applications/Spreadsheet | |
parent | 9b6c09e2c4ff79714dfecb4a98222bec9cc72b71 (diff) | |
download | serenity-b7e5f08e561696001d9b0ced8f3fe50caf186d2c.zip |
LibJS: Convert Object::get() to ThrowCompletionOr
To no one's surprise, this patch is pretty big - this is possibly the
most used AO of all of them. Definitely worth it though.
Diffstat (limited to 'Userland/Applications/Spreadsheet')
-rw-r--r-- | Userland/Applications/Spreadsheet/Spreadsheet.cpp | 12 | ||||
-rw-r--r-- | Userland/Applications/Spreadsheet/SpreadsheetModel.cpp | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index 5c4278bd96..85b58501cf 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -378,8 +378,8 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook) sheet->add_column(); } - auto json = sheet->interpreter().global_object().get("JSON"); - auto& parse_function = json.as_object().get("parse").as_function(); + auto json = sheet->interpreter().global_object().get_without_side_effects("JSON"); + auto& parse_function = json.as_object().get_without_side_effects("parse").as_function(); auto read_format = [](auto& format, const auto& obj) { if (auto value = obj.get("foreground_color"); value.is_string()) @@ -532,8 +532,8 @@ JsonObject Sheet::to_json() const data.set("kind", it.value->kind() == Cell::Kind::Formula ? "Formula" : "LiteralString"); if (it.value->kind() == Cell::Formula) { data.set("source", it.value->data()); - auto json = interpreter().global_object().get("JSON"); - auto stringified_or_error = interpreter().vm().call(json.as_object().get("stringify").as_function(), json, it.value->evaluated_data()); + auto json = interpreter().global_object().get_without_side_effects("JSON"); + auto stringified_or_error = interpreter().vm().call(json.as_object().get_without_side_effects("stringify").as_function(), json, it.value->evaluated_data()); VERIFY(!stringified_or_error.is_error()); data.set("value", stringified_or_error.release_value().to_string_without_side_effects()); } else { @@ -651,7 +651,7 @@ JsonObject Sheet::gather_documentation() const const JS::PropertyName doc_name { "__documentation" }; auto add_docs_from = [&](auto& it, auto& global_object) { - auto value = global_object.get(it.key); + auto value = global_object.get(it.key).release_value(); if (!value.is_function() && !value.is_object()) return; @@ -660,7 +660,7 @@ JsonObject Sheet::gather_documentation() const return; dbgln("Found '{}'", it.key.to_display_string()); - auto doc = value_object.get(doc_name); + auto doc = value_object.get(doc_name).release_value(); if (!doc.is_string()) return; diff --git a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp index 8bb29da7b7..49e7e5bf04 100644 --- a/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp +++ b/Userland/Applications/Spreadsheet/SpreadsheetModel.cpp @@ -35,7 +35,7 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) if (value.is_object()) { auto& object = value.as_object(); if (is<JS::Error>(object)) { - auto error = object.get("message").to_string_without_side_effects(); + auto error = object.get_without_side_effects("message").to_string_without_side_effects(); builder.append(error); return builder.to_string(); } |