1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibJS: Make well-known symbol getters return NonnullGCPtr

None of these are ever null after the VM has been initialized, as proved
by virtually every caller immediately dereferencing the raw pointer.
This commit is contained in:
Linus Groh 2023-04-13 01:14:45 +02:00
parent b84f8fb55b
commit 2555d7a36a
78 changed files with 122 additions and 121 deletions

View file

@ -302,7 +302,7 @@ ThrowCompletionOr<bool> Value::is_regexp(VM& vm) const
return false;
// 2. Let matcher be ? Get(argument, @@match).
auto matcher = TRY(as_object().get(*vm.well_known_symbol_match()));
auto matcher = TRY(as_object().get(vm.well_known_symbol_match()));
// 3. If matcher is not undefined, return ToBoolean(matcher).
if (!matcher.is_undefined())
@ -508,7 +508,7 @@ ThrowCompletionOr<Value> Value::to_primitive(VM& vm, PreferredType preferred_typ
// 1. If input is an Object, then
if (is_object()) {
// a. Let exoticToPrim be ? GetMethod(input, @@toPrimitive).
auto* exotic_to_primitive = TRY(get_method(vm, *vm.well_known_symbol_to_primitive()));
auto* exotic_to_primitive = TRY(get_method(vm, vm.well_known_symbol_to_primitive()));
// b. If exoticToPrim is not undefined, then
if (exotic_to_primitive) {
@ -2062,7 +2062,7 @@ ThrowCompletionOr<Value> instance_of(VM& vm, Value value, Value target)
return vm.throw_completion<TypeError>(ErrorType::NotAnObject, TRY_OR_THROW_OOM(vm, target.to_string_without_side_effects()));
// 2. Let instOfHandler be ? GetMethod(target, @@hasInstance).
auto* instance_of_handler = TRY(target.get_method(vm, *vm.well_known_symbol_has_instance()));
auto* instance_of_handler = TRY(target.get_method(vm, vm.well_known_symbol_has_instance()));
// 3. If instOfHandler is not undefined, then
if (instance_of_handler) {