mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibJS: Return a GC::Ref from Temporal::get_options_object
The Object returned here is always non-null.
This commit is contained in:
Notes:
github-actions[bot]
2024-11-21 00:06:36 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/e4e05837e18 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2431 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/shannonbooth ✅
@@ -13,20 +13,20 @@
|
||||
namespace JS::Temporal {
|
||||
|
||||
// 14.4.1.1 GetOptionsObject ( options ), https://tc39.es/proposal-temporal/#sec-getoptionsobject
|
||||
ThrowCompletionOr<Object*> get_options_object(VM& vm, Value options)
|
||||
ThrowCompletionOr<GC::Ref<Object>> get_options_object(VM& vm, Value options)
|
||||
{
|
||||
auto& realm = *vm.current_realm();
|
||||
|
||||
// 1. If options is undefined, then
|
||||
if (options.is_undefined()) {
|
||||
// a. Return OrdinaryObjectCreate(null).
|
||||
return Object::create(realm, nullptr).ptr();
|
||||
return Object::create(realm, nullptr);
|
||||
}
|
||||
|
||||
// 2. If options is an Object, then
|
||||
if (options.is_object()) {
|
||||
// a. Return options.
|
||||
return &options.as_object();
|
||||
return options.as_object();
|
||||
}
|
||||
|
||||
// 3. Throw a TypeError exception.
|
||||
|
||||
Reference in New Issue
Block a user