1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:57:44 +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

@ -55,7 +55,7 @@ float Length::relative_length_to_px(const Layout::Node& layout_node) const
return max(viewport.width(), viewport.height()) * (m_value / 100);
}
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -97,7 +97,7 @@ const char* Length::unit_name() const
case Type::Vmin:
return "vmin";
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -143,7 +143,7 @@ public:
case Type::Undefined:
case Type::Percentage:
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}

View file

@ -33,11 +33,11 @@
#include <stdlib.h>
#include <string.h>
#define PARSE_ASSERT(x) \
#define PARSE_VERIFY(x) \
if (!(x)) { \
dbgln("CSS PARSER ASSERTION FAILED: {}", #x); \
dbgln("At character# {} in CSS: _{}_", index, css); \
ASSERT_NOT_REACHED(); \
VERIFY_NOT_REACHED(); \
}
#define PARSE_ERROR() \
@ -344,7 +344,7 @@ public:
char consume_one()
{
PARSE_ASSERT(index < css.length());
PARSE_VERIFY(index < css.length());
return css[index++];
};
@ -424,7 +424,7 @@ public:
if (type != CSS::Selector::SimpleSelector::Type::Universal) {
while (is_valid_selector_char(peek()))
buffer.append(consume_one());
PARSE_ASSERT(!buffer.is_null());
PARSE_VERIFY(!buffer.is_null());
}
auto value = String::copy(buffer);
@ -593,7 +593,7 @@ public:
break;
simple_selectors.append(component.value());
// If this assert triggers, we're most likely up to no good.
PARSE_ASSERT(simple_selectors.size() < 100);
PARSE_VERIFY(simple_selectors.size() < 100);
}
if (simple_selectors.is_empty())
@ -682,7 +682,7 @@ public:
continue;
}
if (ch == ')') {
PARSE_ASSERT(paren_nesting_level > 0);
PARSE_VERIFY(paren_nesting_level > 0);
--paren_nesting_level;
buffer.append(consume_one());
continue;

View file

@ -119,7 +119,7 @@ static bool matches(const CSS::Selector::SimpleSelector& component, const DOM::E
case CSS::Selector::SimpleSelector::Type::TagName:
return component.value == element.local_name();
default:
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
}
@ -134,7 +134,7 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con
case CSS::Selector::ComplexSelector::Relation::None:
return true;
case CSS::Selector::ComplexSelector::Relation::Descendant:
ASSERT(component_list_index != 0);
VERIFY(component_list_index != 0);
for (auto* ancestor = element.parent(); ancestor; ancestor = ancestor->parent()) {
if (!is<DOM::Element>(*ancestor))
continue;
@ -143,29 +143,29 @@ static bool matches(const CSS::Selector& selector, int component_list_index, con
}
return false;
case CSS::Selector::ComplexSelector::Relation::ImmediateChild:
ASSERT(component_list_index != 0);
VERIFY(component_list_index != 0);
if (!element.parent() || !is<DOM::Element>(*element.parent()))
return false;
return matches(selector, component_list_index - 1, downcast<DOM::Element>(*element.parent()));
case CSS::Selector::ComplexSelector::Relation::AdjacentSibling:
ASSERT(component_list_index != 0);
VERIFY(component_list_index != 0);
if (auto* sibling = element.previous_element_sibling())
return matches(selector, component_list_index - 1, *sibling);
return false;
case CSS::Selector::ComplexSelector::Relation::GeneralSibling:
ASSERT(component_list_index != 0);
VERIFY(component_list_index != 0);
for (auto* sibling = element.previous_element_sibling(); sibling; sibling = sibling->previous_element_sibling()) {
if (matches(selector, component_list_index - 1, *sibling))
return true;
}
return false;
}
ASSERT_NOT_REACHED();
VERIFY_NOT_REACHED();
}
bool matches(const CSS::Selector& selector, const DOM::Element& element)
{
ASSERT(!selector.complex_selectors().is_empty());
VERIFY(!selector.complex_selectors().is_empty());
return matches(selector, selector.complex_selectors().size() - 1, element);
}

View file

@ -188,7 +188,7 @@ static bool contains(Edge a, Edge b)
static inline void set_property_border_width(StyleProperties& style, const StyleValue& value, Edge edge)
{
ASSERT(value.is_length());
VERIFY(value.is_length());
if (contains(Edge::Top, edge))
style.set_property(CSS::PropertyID::BorderTopWidth, value);
if (contains(Edge::Right, edge))
@ -201,7 +201,7 @@ static inline void set_property_border_width(StyleProperties& style, const Style
static inline void set_property_border_color(StyleProperties& style, const StyleValue& value, Edge edge)
{
ASSERT(value.is_color());
VERIFY(value.is_color());
if (contains(Edge::Top, edge))
style.set_property(CSS::PropertyID::BorderTopColor, value);
if (contains(Edge::Right, edge))
@ -214,7 +214,7 @@ static inline void set_property_border_color(StyleProperties& style, const Style
static inline void set_property_border_style(StyleProperties& style, const StyleValue& value, Edge edge)
{
ASSERT(value.is_string());
VERIFY(value.is_string());
if (contains(Edge::Top, edge))
style.set_property(CSS::PropertyID::BorderTopStyle, value);
if (contains(Edge::Right, edge))

View file

@ -54,7 +54,7 @@ Color IdentifierStyleValue::to_color(const DOM::Document& document) const
if (id() == CSS::ValueID::LibwebLink)
return document.link_color();
ASSERT(document.page());
VERIFY(document.page());
auto palette = document.page()->palette();
switch (id()) {
case CSS::ValueID::LibwebPaletteDesktopBackground: