diff options
author | Linus Groh <mail@linusgroh.de> | 2022-08-16 20:33:17 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-08-23 13:58:30 +0100 |
commit | f3117d46dc872a2d0f57273293b5691777b06279 (patch) | |
tree | d16e8d78bfc9c94e3e6d4188f8a853a148b2b5c8 /Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp | |
parent | 5398dcc55e1b8279f6b3edf62ad249a27b4f2f64 (diff) | |
download | serenity-f3117d46dc872a2d0f57273293b5691777b06279.zip |
LibJS: Remove GlobalObject from VM::throw_completion()
This is a continuation of the previous five commits.
A first big step into the direction of no longer having to pass a realm
(or currently, a global object) trough layers upon layers of AOs!
Unlike the create() APIs we can safely assume that this is only ever
called when a running execution context and therefore current realm
exists. If not, you can always manually allocate the Error and put it in
a Completion :^)
In the spec, throw exceptions implicitly use the current realm's
intrinsics as well: https://tc39.es/ecma262/#sec-throw-an-exception
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp index 595c8686f9..78b00cc4e5 100644 --- a/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Intl/AbstractOperations.cpp @@ -229,7 +229,7 @@ ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject& global_ // ii. If Type(kValue) is not String or Object, throw a TypeError exception. if (!key_value.is_string() && !key_value.is_object()) - return vm.throw_completion<TypeError>(global_object, ErrorType::NotAnObjectOrString, key_value.to_string_without_side_effects()); + return vm.throw_completion<TypeError>(ErrorType::NotAnObjectOrString, key_value.to_string_without_side_effects()); String tag; @@ -247,7 +247,7 @@ ThrowCompletionOr<Vector<String>> canonicalize_locale_list(GlobalObject& global_ // v. If ! IsStructurallyValidLanguageTag(tag) is false, throw a RangeError exception. auto locale_id = is_structurally_valid_language_tag(tag); if (!locale_id.has_value()) - return vm.throw_completion<RangeError>(global_object, ErrorType::IntlInvalidLanguageTag, tag); + return vm.throw_completion<RangeError>(ErrorType::IntlInvalidLanguageTag, tag); // vi. Let canonicalizedTag be ! CanonicalizeUnicodeLocaleId(tag). auto canonicalized_tag = JS::Intl::canonicalize_unicode_locale_id(*locale_id); @@ -658,7 +658,7 @@ ThrowCompletionOr<Optional<int>> default_number_option(GlobalObject& global_obje // 3. If value is NaN or less than minimum or greater than maximum, throw a RangeError exception. if (value.is_nan() || (value.as_double() < minimum) || (value.as_double() > maximum)) - return vm.throw_completion<RangeError>(global_object, ErrorType::IntlNumberIsNaNOrOutOfRange, value, minimum, maximum); + return vm.throw_completion<RangeError>(ErrorType::IntlNumberIsNaNOrOutOfRange, value, minimum, maximum); // 4. Return floor(value). return floor(value.as_double()); |