diff --git a/Userland/Libraries/LibJS/AST.cpp b/Userland/Libraries/LibJS/AST.cpp index 79d93b1bea..0b95c3476c 100644 --- a/Userland/Libraries/LibJS/AST.cpp +++ b/Userland/Libraries/LibJS/AST.cpp @@ -884,7 +884,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob Object* super_constructor_prototype = nullptr; if (!super_constructor.is_null()) { - auto super_constructor_prototype_value = super_constructor.as_object().get(vm.names.prototype).value_or(js_undefined()); + auto super_constructor_prototype_value = super_constructor.as_object().get(vm.names.prototype); if (interpreter.exception()) return {}; if (!super_constructor_prototype_value.is_object() && !super_constructor_prototype_value.is_null()) { diff --git a/Userland/Libraries/LibJS/Bytecode/Op.cpp b/Userland/Libraries/LibJS/Bytecode/Op.cpp index 7b3a16de98..bfefe55b17 100644 --- a/Userland/Libraries/LibJS/Bytecode/Op.cpp +++ b/Userland/Libraries/LibJS/Bytecode/Op.cpp @@ -228,7 +228,7 @@ void SetVariable::execute_impl(Bytecode::Interpreter& interpreter) const void GetById::execute_impl(Bytecode::Interpreter& interpreter) const { if (auto* object = interpreter.accumulator().to_object(interpreter.global_object())) - interpreter.accumulator() = object->get(interpreter.current_executable().get_string(m_property)).value_or(js_undefined()); + interpreter.accumulator() = object->get(interpreter.current_executable().get_string(m_property)); } void PutById::execute_impl(Bytecode::Interpreter& interpreter) const @@ -417,7 +417,7 @@ void GetByValue::execute_impl(Bytecode::Interpreter& interpreter) const auto property_key = interpreter.accumulator().to_property_key(interpreter.global_object()); if (interpreter.vm().exception()) return; - interpreter.accumulator() = object->get(property_key).value_or(js_undefined()); + interpreter.accumulator() = object->get(property_key); } } diff --git a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp index c6176fd17d..85b11d06fc 100644 --- a/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/AbstractOperations.cpp @@ -49,7 +49,7 @@ Value require_object_coercible(GlobalObject& global_object, Value value) size_t length_of_array_like(GlobalObject& global_object, Object const& object) { auto& vm = global_object.vm(); - auto result = object.get(vm.names.length).value_or(js_undefined()); + auto result = object.get(vm.names.length); if (vm.exception()) return INVALID; return result.to_length(global_object); @@ -71,7 +71,7 @@ MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value v auto list = MarkedValueList { heap }; for (size_t i = 0; i < length; ++i) { auto index_name = String::number(i); - auto next = array_like.get(index_name).value_or(js_undefined()); + auto next = array_like.get(index_name); if (vm.exception()) return MarkedValueList { heap }; if (check_value) { @@ -90,7 +90,7 @@ MarkedValueList create_list_from_array_like(GlobalObject& global_object, Value v FunctionObject* species_constructor(GlobalObject& global_object, Object const& object, FunctionObject& default_constructor) { auto& vm = global_object.vm(); - auto constructor = object.get(vm.names.constructor).value_or(js_undefined()); + auto constructor = object.get(vm.names.constructor); if (vm.exception()) return nullptr; if (constructor.is_undefined()) @@ -99,7 +99,7 @@ FunctionObject* species_constructor(GlobalObject& global_object, Object const& o vm.throw_exception(global_object, ErrorType::NotAConstructor, constructor.to_string_without_side_effects()); return nullptr; } - auto species = constructor.as_object().get(*vm.well_known_symbol_species()).value_or(js_undefined()); + auto species = constructor.as_object().get(*vm.well_known_symbol_species()); if (species.is_nullish()) return &default_constructor; if (species.is_constructor()) diff --git a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp index 0f51bdf008..80012fb577 100644 --- a/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ArrayPrototype.cpp @@ -108,7 +108,7 @@ static Object* array_species_create(GlobalObject& global_object, Object& origina return array; } - auto constructor = original_array.get(vm.names.constructor).value_or(js_undefined()); + auto constructor = original_array.get(vm.names.constructor); if (vm.exception()) return {}; if (constructor.is_constructor()) { @@ -123,7 +123,7 @@ static Object* array_species_create(GlobalObject& global_object, Object& origina } if (constructor.is_object()) { - constructor = constructor.as_object().get(*vm.well_known_symbol_species()).value_or(js_undefined()); + constructor = constructor.as_object().get(*vm.well_known_symbol_species()); if (vm.exception()) return {}; if (constructor.is_null()) @@ -396,7 +396,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::unshift) if (vm.exception()) return {}; if (from_present) { - auto from_value = this_object->get(from).value_or(js_undefined()); + auto from_value = this_object->get(from); if (vm.exception()) return {}; this_object->define_property(to, from_value); @@ -442,7 +442,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::pop) return js_undefined(); } auto index = length - 1; - auto element = this_object->get(index).value_or(js_undefined()); + auto element = this_object->get(index); if (vm.exception()) return {}; this_object->delete_property_or_throw(index); @@ -469,7 +469,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift) return {}; return js_undefined(); } - auto first = this_object->get(0).value_or(js_undefined()); + auto first = this_object->get(0); if (vm.exception()) return {}; @@ -480,7 +480,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::shift) if (vm.exception()) return {}; if (from_present) { - auto from_value = this_object->get(from).value_or(js_undefined()); + auto from_value = this_object->get(from); if (vm.exception()) return {}; this_object->define_property(to, from_value); @@ -540,7 +540,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::to_locale_string) for (size_t i = 0; i < length; ++i) { if (i > 0) builder.append(separator); - auto value = this_object->get(i).value_or(js_undefined()); + auto value = this_object->get(i); if (vm.exception()) return {}; if (value.is_nullish()) @@ -589,7 +589,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::join) for (size_t i = 0; i < length; ++i) { if (i > 0) builder.append(separator); - auto value = this_object->get(i).value_or(js_undefined()); + auto value = this_object->get(i); if (vm.exception()) return {}; if (value.is_nullish()) @@ -625,7 +625,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::concat) if (vm.exception()) return false; - auto spreadable = object->get(*vm.well_known_symbol_is_concat_spreadable()).value_or(js_undefined()); + auto spreadable = object->get(*vm.well_known_symbol_is_concat_spreadable()); if (vm.exception()) return false; @@ -1075,7 +1075,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse) return {}; Value lower_value; if (lower_exists) { - lower_value = this_object->get(lower).value_or(js_undefined()); + lower_value = this_object->get(lower); if (vm.exception()) return {}; } @@ -1085,7 +1085,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::reverse) return {}; Value upper_value; if (upper_exists) { - upper_value = this_object->get(upper).value_or(js_undefined()); + upper_value = this_object->get(upper); if (vm.exception()) return {}; } @@ -1386,7 +1386,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::includes) } auto value_to_find = vm.argument(0); for (i32 i = from_index; i < length; ++i) { - auto element = this_object->get(i).value_or(js_undefined()); + auto element = this_object->get(i); if (vm.exception()) return {}; if (same_value_zero(element, value_to_find)) @@ -1818,7 +1818,7 @@ static size_t flatten_into_array(GlobalObject& global_object, Object& new_array, if (!value_exists) continue; - auto value = array.get(j).value_or(js_undefined()); + auto value = array.get(j); if (vm.exception()) return {}; @@ -1981,7 +1981,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::copy_within) return {}; if (from_present) { - auto from_value = this_object->get(from_i).value_or(js_undefined()); + auto from_value = this_object->get(from_i); if (vm.exception()) return {}; this_object->put(to_i, from_value); @@ -2024,7 +2024,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayPrototype::at) } if (index.has_overflow() || index.value() >= length) return js_undefined(); - return this_object->get(index.value()).value_or(js_undefined()); + return this_object->get(index.value()); } } diff --git a/Userland/Libraries/LibJS/Runtime/Error.cpp b/Userland/Libraries/LibJS/Runtime/Error.cpp index 8eddcc68b8..abec4eba16 100644 --- a/Userland/Libraries/LibJS/Runtime/Error.cpp +++ b/Userland/Libraries/LibJS/Runtime/Error.cpp @@ -38,7 +38,7 @@ void Error::install_error_cause(Value options) auto& options_object = options.as_object(); if (!options_object.has_property(vm.names.cause)) return; - auto cause = options_object.get(vm.names.cause).value_or(js_undefined()); + auto cause = options_object.get(vm.names.cause); if (vm.exception()) return; define_property(vm.names.cause, cause, Attribute::Writable | Attribute::Configurable); diff --git a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp index a902cd5bf3..7b16468660 100644 --- a/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/ErrorPrototype.cpp @@ -40,7 +40,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string) auto& this_object = this_value.as_object(); String name = "Error"; - auto name_property = this_object.get(vm.names.name).value_or(js_undefined()); + auto name_property = this_object.get(vm.names.name); if (vm.exception()) return {}; if (!name_property.is_undefined()) { @@ -50,7 +50,7 @@ JS_DEFINE_NATIVE_FUNCTION(ErrorPrototype::to_string) } String message = ""; - auto message_property = this_object.get(vm.names.message).value_or(js_undefined()); + auto message_property = this_object.get(vm.names.message); if (vm.exception()) return {}; if (!message_property.is_undefined()) { diff --git a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp index fbd57f2bd5..1394705c59 100644 --- a/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/IteratorOperations.cpp @@ -74,7 +74,7 @@ Object* iterator_next(Object& iterator, Value value) bool iterator_complete(GlobalObject& global_object, Object& iterator_result) { auto& vm = global_object.vm(); - auto done = iterator_result.get(vm.names.done).value_or(js_undefined()); + auto done = iterator_result.get(vm.names.done); if (vm.exception()) return {}; return done.to_boolean(); @@ -84,7 +84,7 @@ bool iterator_complete(GlobalObject& global_object, Object& iterator_result) Value iterator_value(GlobalObject& global_object, Object& iterator_result) { auto& vm = global_object.vm(); - auto value = iterator_result.get(vm.names.value).value_or(js_undefined()); + auto value = iterator_result.get(vm.names.value); if (vm.exception()) return {}; return value; diff --git a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp index 91616f805f..7946cf53fe 100644 --- a/Userland/Libraries/LibJS/Runtime/JSONObject.cpp +++ b/Userland/Libraries/LibJS/Runtime/JSONObject.cpp @@ -146,7 +146,7 @@ JS_DEFINE_NATIVE_FUNCTION(JSONObject::stringify) String JSONObject::serialize_json_property(GlobalObject& global_object, StringifyState& state, const PropertyName& key, Object* holder) { auto& vm = global_object.vm(); - auto value = holder->get(key).value_or(js_undefined()); + auto value = holder->get(key); if (vm.exception()) return {}; if (value.is_object() || value.is_bigint()) { @@ -479,7 +479,7 @@ Array* JSONObject::parse_json_array(GlobalObject& global_object, const JsonArray Value JSONObject::internalize_json_property(GlobalObject& global_object, Object* holder, PropertyName const& name, FunctionObject& reviver) { auto& vm = global_object.vm(); - auto value = holder->get(name).value_or(js_undefined()); + auto value = holder->get(name); if (vm.exception()) return {}; if (value.is_object()) { diff --git a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp index 2434a87ec1..1653b35840 100644 --- a/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/MapConstructor.cpp @@ -70,10 +70,10 @@ Value MapConstructor::construct(FunctionObject& new_target) vm.throw_exception(global_object, ErrorType::NotAnObject, String::formatted("Iterator value {}", iterator_value.to_string_without_side_effects())); return IterationDecision::Break; } - auto key = iterator_value.as_object().get(0).value_or(js_undefined()); + auto key = iterator_value.as_object().get(0); if (vm.exception()) return IterationDecision::Break; - auto value = iterator_value.as_object().get(1).value_or(js_undefined()); + auto value = iterator_value.as_object().get(1); if (vm.exception()) return IterationDecision::Break; (void)vm.call(adder.as_function(), Value(map), key, value); diff --git a/Userland/Libraries/LibJS/Runtime/Object.cpp b/Userland/Libraries/LibJS/Runtime/Object.cpp index a641e6e6c9..fcd6c9c35b 100644 --- a/Userland/Libraries/LibJS/Runtime/Object.cpp +++ b/Userland/Libraries/LibJS/Runtime/Object.cpp @@ -1216,7 +1216,7 @@ Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const Value Object::invoke_internal(const StringOrSymbol& property_name, Optional arguments) { auto& vm = this->vm(); - auto property = get(property_name).value_or(js_undefined()); + auto property = get(property_name); if (vm.exception()) return {}; if (!property.is_function()) { diff --git a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp index 70f28e4c19..44b543ea90 100644 --- a/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ObjectConstructor.cpp @@ -254,10 +254,10 @@ JS_DEFINE_NATIVE_FUNCTION(ObjectConstructor::from_entries) vm.throw_exception(global_object, ErrorType::NotAnObject, String::formatted("Iterator value {}", iterator_value.to_string_without_side_effects())); return IterationDecision::Break; } - auto key = iterator_value.as_object().get(0).value_or(js_undefined()); + auto key = iterator_value.as_object().get(0); if (vm.exception()) return IterationDecision::Break; - auto value = iterator_value.as_object().get(1).value_or(js_undefined()); + auto value = iterator_value.as_object().get(1); if (vm.exception()) return IterationDecision::Break; auto property_key = key.to_property_key(global_object); diff --git a/Userland/Libraries/LibJS/Runtime/Promise.cpp b/Userland/Libraries/LibJS/Runtime/Promise.cpp index 81189f3777..bd9d16c29e 100644 --- a/Userland/Libraries/LibJS/Runtime/Promise.cpp +++ b/Userland/Libraries/LibJS/Runtime/Promise.cpp @@ -22,7 +22,7 @@ Object* promise_resolve(GlobalObject& global_object, Object& constructor, Value { auto& vm = global_object.vm(); if (value.is_object() && is(value.as_object())) { - auto value_constructor = value.as_object().get(vm.names.constructor).value_or(js_undefined()); + auto value_constructor = value.as_object().get(vm.names.constructor); if (vm.exception()) return nullptr; if (same_value(value_constructor, &constructor)) diff --git a/Userland/Libraries/LibJS/Runtime/Reference.cpp b/Userland/Libraries/LibJS/Runtime/Reference.cpp index ac3152631e..200d6fc9fc 100644 --- a/Userland/Libraries/LibJS/Runtime/Reference.cpp +++ b/Userland/Libraries/LibJS/Runtime/Reference.cpp @@ -94,7 +94,7 @@ Value Reference::get_value(GlobalObject& global_object, bool throw_if_undefined) auto* base_obj = m_base_value.to_object(global_object); if (!base_obj) return {}; - return base_obj->get(m_name).value_or(js_undefined()); + return base_obj->get(m_name); } VERIFY(m_base_type == BaseType::Environment); diff --git a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp index 29cd6f1b99..4c9759fd6e 100644 --- a/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/RegExpPrototype.cpp @@ -109,11 +109,11 @@ JS_DEFINE_NATIVE_GETTER(RegExpPrototype::flags) StringBuilder builder(8); -#define __JS_ENUMERATE(flagName, flag_name, flag_char, ECMAScriptFlagName) \ - auto flag_##flag_name = this_object->get(vm.names.flagName).value_or(js_undefined()); \ - if (vm.exception()) \ - return {}; \ - if (flag_##flag_name.to_boolean()) \ +#define __JS_ENUMERATE(flagName, flag_name, flag_char, ECMAScriptFlagName) \ + auto flag_##flag_name = this_object->get(vm.names.flagName); \ + if (vm.exception()) \ + return {}; \ + if (flag_##flag_name.to_boolean()) \ builder.append(#flag_char); JS_ENUMERATE_REGEXP_FLAGS #undef __JS_ENUMERATE @@ -231,14 +231,14 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::to_string) if (!this_object) return {}; - auto source_attr = this_object->get(vm.names.source).value_or(js_undefined()); + auto source_attr = this_object->get(vm.names.source); if (vm.exception()) return {}; auto pattern = source_attr.to_string(global_object); if (vm.exception()) return {}; - auto flags_attr = this_object->get(vm.names.flags).value_or(js_undefined()); + auto flags_attr = this_object->get(vm.names.flags); if (vm.exception()) return {}; auto flags = flags_attr.to_string(global_object); @@ -257,7 +257,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_match) auto s = vm.argument(0).to_string(global_object); if (vm.exception()) return {}; - auto global_value = rx->get(vm.names.global).value_or(js_undefined()); + auto global_value = rx->get(vm.names.global); if (vm.exception()) return {}; bool global = global_value.to_boolean(); @@ -286,7 +286,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) if (vm.exception()) return {}; - auto global_value = rx->get(vm.names.global).value_or(js_undefined()); + auto global_value = rx->get(vm.names.global); if (vm.exception()) return {}; @@ -338,7 +338,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) size_t result_length = length_of_array_like(global_object, result); size_t n_captures = result_length == 0 ? 0 : result_length - 1; - auto matched_value = result.get(0).value_or(js_undefined()); + auto matched_value = result.get(0); if (vm.exception()) return {}; @@ -346,7 +346,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) if (vm.exception()) return {}; - auto position_value = result.get(vm.names.index).value_or(js_undefined()); + auto position_value = result.get(vm.names.index); if (vm.exception()) return {}; @@ -358,7 +358,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) MarkedValueList captures(vm.heap()); for (size_t n = 1; n <= n_captures; ++n) { - auto capture = result.get(n).value_or(js_undefined()); + auto capture = result.get(n); if (vm.exception()) return {}; @@ -375,7 +375,7 @@ JS_DEFINE_NATIVE_FUNCTION(RegExpPrototype::symbol_replace) captures.append(move(capture)); } - auto named_captures = result.get(vm.names.groups).value_or(js_undefined()); + auto named_captures = result.get(vm.names.groups); if (vm.exception()) return {}; diff --git a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp index 36cdb96c78..cc336f4def 100644 --- a/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringConstructor.cpp @@ -78,7 +78,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::raw) if (vm.exception()) return {}; - auto raw_value = cooked->get(vm.names.raw).value_or(js_undefined()); + auto raw_value = cooked->get(vm.names.raw); if (vm.exception()) return {}; diff --git a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp index 4e443d02cb..4ef4af6d1d 100644 --- a/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/StringPrototype.cpp @@ -755,7 +755,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::match_all) if (vm.exception()) return {}; if (is_regexp) { - auto flags = regexp.as_object().get("flags").value_or(js_undefined()); + auto flags = regexp.as_object().get("flags"); if (vm.exception()) return {}; auto flags_object = require_object_coercible(global_object, flags); diff --git a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp index ef719d62f8..f5a10a18de 100644 --- a/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp +++ b/Userland/Libraries/LibJS/Runtime/TypedArrayPrototype.cpp @@ -230,7 +230,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::join) for (size_t i = 0; i < length; ++i) { if (i > 0) builder.append(separator); - auto value = typed_array->get(i).value_or(js_undefined()); + auto value = typed_array->get(i); if (vm.exception()) return {}; if (value.is_nullish()) diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp index 0ba42530a6..031c1a72c5 100644 --- a/Userland/Libraries/LibJS/Runtime/VM.cpp +++ b/Userland/Libraries/LibJS/Runtime/VM.cpp @@ -228,7 +228,7 @@ void VM::assign(const NonnullRefPtr& target, Value value, Global if (exception()) return; - if (!done_property.is_empty() && done_property.to_boolean()) + if (done_property.to_boolean()) break; auto next_value = next_object->get(names.value); @@ -247,7 +247,7 @@ void VM::assign(const NonnullRefPtr& target, Value value, Global if (exception()) return; - if (!done_property.is_empty() && done_property.to_boolean()) { + if (done_property.to_boolean()) { iterator = nullptr; value = js_undefined(); } else { diff --git a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp index 3c811164dc..726a9096ba 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMapConstructor.cpp @@ -68,10 +68,10 @@ Value WeakMapConstructor::construct(FunctionObject& new_target) vm.throw_exception(global_object, ErrorType::NotAnObject, String::formatted("Iterator value {}", iterator_value.to_string_without_side_effects())); return IterationDecision::Break; } - auto key = iterator_value.as_object().get(0).value_or(js_undefined()); + auto key = iterator_value.as_object().get(0); if (vm.exception()) return IterationDecision::Break; - auto value = iterator_value.as_object().get(1).value_or(js_undefined()); + auto value = iterator_value.as_object().get(1); if (vm.exception()) return IterationDecision::Break; (void)vm.call(adder.as_function(), Value(weak_map), key, value);