1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 21:07:36 +00:00

Everywhere: Rename ASSERT => VERIFY

(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
This commit is contained in:
Andreas Kling 2021-02-23 20:42:32 +01:00
parent b33a6a443e
commit 5d180d1f99
725 changed files with 3448 additions and 3448 deletions

View file

@ -89,8 +89,8 @@ Document::~Document()
void Document::removed_last_ref()
{
ASSERT(!ref_count());
ASSERT(!m_deletion_has_begun);
VERIFY(!ref_count());
VERIFY(!m_deletion_has_begun);
if (m_referencing_node_count) {
// The document has reached ref_count==0 but still has nodes keeping it alive.
@ -121,8 +121,8 @@ void Document::removed_last_ref()
});
for (auto& node : descendants) {
ASSERT(&node.document() == this);
ASSERT(!node.is_document());
VERIFY(&node.document() == this);
VERIFY(!node.is_document());
if (node.parent())
node.parent()->remove_child(node);
}
@ -299,7 +299,7 @@ void Document::attach_to_frame(Badge<Frame>, Frame& frame)
void Document::detach_from_frame(Badge<Frame>, Frame& frame)
{
ASSERT(&frame == m_frame);
VERIFY(&frame == m_frame);
tear_down_layout_tree();
m_frame = nullptr;
}

View file

@ -259,14 +259,14 @@ private:
void increment_referencing_node_count()
{
ASSERT(!m_deletion_has_begun);
VERIFY(!m_deletion_has_begun);
++m_referencing_node_count;
}
void decrement_referencing_node_count()
{
ASSERT(!m_deletion_has_begun);
ASSERT(m_referencing_node_count);
VERIFY(!m_deletion_has_begun);
VERIFY(m_referencing_node_count);
--m_referencing_node_count;
if (!m_referencing_node_count && !ref_count()) {
m_deletion_has_begun = true;

View file

@ -131,7 +131,7 @@ RefPtr<Layout::Node> Element::create_layout_node()
switch (display) {
case CSS::Display::None:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
break;
case CSS::Display::Block:
return adopt(*new Layout::BlockBox(document(), this, move(style)));
@ -164,7 +164,7 @@ RefPtr<Layout::Node> Element::create_layout_node()
// FIXME: This is just an incorrect placeholder until we improve table layout support.
return adopt(*new Layout::BlockBox(document(), this, move(style)));
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
void Element::parse_attribute(const FlyString& name, const String& value)
@ -214,7 +214,7 @@ static StyleDifference compute_style_difference(const CSS::StyleProperties& old_
void Element::recompute_style()
{
set_needs_style_update(false);
ASSERT(parent());
VERIFY(parent());
auto old_specified_css_values = m_specified_css_values;
auto new_specified_css_values = document().style_resolver().resolve_style(*this);
m_specified_css_values = new_specified_css_values;

View file

@ -136,7 +136,7 @@ void EventDispatcher::invoke(Event::PathEntry& struct_, Event& event, Event::Pha
return entry.index <= struct_.index && !entry.shadow_adjusted_target.is_null();
});
ASSERT(last_valid_shadow_adjusted_target.has_value());
VERIFY(last_valid_shadow_adjusted_target.has_value());
event.set_target(last_valid_shadow_adjusted_target.value().shadow_adjusted_target);
event.set_related_target(struct_.related_target);
@ -249,7 +249,7 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
return !entry.shadow_adjusted_target.is_null();
});
ASSERT(clear_targets_struct.has_value());
VERIFY(clear_targets_struct.has_value());
if (is<Node>(clear_targets_struct.value().shadow_adjusted_target.ptr())) {
auto& shadow_adjusted_target_node = downcast<Node>(*clear_targets_struct.value().shadow_adjusted_target);

View file

@ -31,7 +31,7 @@ namespace Web::DOM {
JS::Function& EventListener::function()
{
ASSERT(m_function.cell());
VERIFY(m_function.cell());
return *m_function.cell();
}

View file

@ -54,7 +54,7 @@ Node::Node(Document& document, NodeType type)
Node::~Node()
{
ASSERT(m_deletion_has_begun);
VERIFY(m_deletion_has_begun);
if (layout_node() && layout_node()->parent())
layout_node()->parent()->remove_child(*layout_node());

View file

@ -95,7 +95,7 @@ i32 Window::set_timeout(JS::Function& callback, i32 interval)
void Window::timer_did_fire(Badge<Timer>, Timer& timer)
{
// We should not be here if there's no JS wrapper for the Window object.
ASSERT(wrapper());
VERIFY(wrapper());
auto& vm = wrapper()->vm();
// NOTE: This protector pointer keeps the timer alive until the end of this function no matter what.