LibGC: Delete operators ! and bool from GC::Ref

The GC::Ref smart pointer is always non-null, so there's no need for it
to be convertible to bool.

This exposed a small number of unnecessary null checks which we remove.
This commit is contained in:
Andreas Kling 2025-10-28 18:48:41 +01:00 committed by Andreas Kling
parent e4e18ca84b
commit 3fb678b376
3 changed files with 3 additions and 2 deletions

View File

@ -71,6 +71,9 @@ public:
operator T&() const { return *m_ptr; }
operator bool() const = delete;
bool operator!() const = delete;
private:
T* m_ptr { nullptr };
};

View File

@ -322,7 +322,6 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::create_class_const
}
auto prototype = Object::create_prototype(realm, proto_parent);
VERIFY(prototype);
// FIXME: Step 14.a is done in the parser. By using a synthetic super(...args) which does not call @@iterator of %Array.prototype%
auto const& constructor = *m_constructor;

View File

@ -1344,7 +1344,6 @@ static Value instantiate_ordinary_function_expression(Interpreter& interpreter,
auto environment = GC::Ref { *interpreter.running_execution_context().lexical_environment };
if (has_own_name) {
VERIFY(environment);
environment = new_declarative_environment(*environment);
MUST(environment->create_immutable_binding(interpreter.vm(), own_name, false));
}