1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:47:45 +00:00

Everywhere: Run clang-format

This commit is contained in:
Linus Groh 2022-10-17 00:06:11 +02:00
parent 8639d8bc21
commit d26aabff04
140 changed files with 1202 additions and 723 deletions

View file

@ -168,7 +168,8 @@ Vector<T> merge_lists(Vector<T> const& a, Vector<T> const& b)
// x modulo y, https://tc39.es/ecma262/#eqn-modulo
template<typename T, typename U>
auto modulo(T x, U y) requires(IsArithmetic<T>, IsArithmetic<U>)
auto modulo(T x, U y)
requires(IsArithmetic<T>, IsArithmetic<U>)
{
// The notation “x modulo y” (y must be finite and non-zero) computes a value k of the same sign as y (or zero) such that abs(k) < abs(y) and x - k = q × y for some integer q.
VERIFY(y != 0);

View file

@ -148,7 +148,8 @@ public:
}
template<typename U = JS::Completion>
explicit(!IsConvertible<U&&, JS::Completion>) Optional(U&& value) requires(!IsSame<RemoveCVReference<U>, Optional<JS::Completion>> && IsConstructible<JS::Completion, U&&>)
explicit(!IsConvertible<U&&, JS::Completion>) Optional(U&& value)
requires(!IsSame<RemoveCVReference<U>, Optional<JS::Completion>> && IsConstructible<JS::Completion, U &&>)
: m_value(forward<U>(value))
{
}
@ -237,7 +238,8 @@ namespace JS {
template<typename ValueType>
class [[nodiscard]] ThrowCompletionOr {
public:
ThrowCompletionOr() requires(IsSame<ValueType, Empty>)
ThrowCompletionOr()
requires(IsSame<ValueType, Empty>)
: m_value(Empty {})
{
}
@ -266,7 +268,8 @@ public:
// Most commonly: Value from Object* or similar, so we can omit the curly braces from "return { TRY(...) };".
// Disabled for POD types to avoid weird conversion shenanigans.
template<typename WrappedValueType>
ThrowCompletionOr(WrappedValueType value) requires(!IsPOD<ValueType>)
ThrowCompletionOr(WrappedValueType value)
requires(!IsPOD<ValueType>)
: m_value(move(value))
{
}
@ -274,8 +277,16 @@ public:
[[nodiscard]] bool is_throw_completion() const { return m_throw_completion.has_value(); }
Completion const& throw_completion() const { return *m_throw_completion; }
[[nodiscard]] bool has_value() const requires(!IsSame<ValueType, Empty>) { return m_value.has_value(); }
[[nodiscard]] ValueType const& value() const requires(!IsSame<ValueType, Empty>) { return *m_value; }
[[nodiscard]] bool has_value() const
requires(!IsSame<ValueType, Empty>)
{
return m_value.has_value();
}
[[nodiscard]] ValueType const& value() const
requires(!IsSame<ValueType, Empty>)
{
return *m_value;
}
// These are for compatibility with the TRY() macro in AK.
[[nodiscard]] bool is_error() const { return m_throw_completion.has_value(); }

View file

@ -65,13 +65,15 @@ public:
private:
friend class Map;
IteratorImpl(Map const& map) requires(IsConst)
IteratorImpl(Map const& map)
requires(IsConst)
: m_map(map)
{
ensure_index();
}
IteratorImpl(Map& map) requires(!IsConst)
IteratorImpl(Map& map)
requires(!IsConst)
: m_map(map)
{
ensure_index();

View file

@ -17,7 +17,10 @@ namespace JS {
#define JS_PROTOTYPE_OBJECT(prototype_class, object_class, display_name_) \
using Prototype = PrototypeObject<prototype_class, object_class>; \
JS_OBJECT(prototype_class, Prototype) \
static constexpr StringView display_name() { return #display_name_##sv; }
static constexpr StringView display_name() \
{ \
return #display_name_##sv; \
}
template<typename PrototypeType, typename ObjectType>
class PrototypeObject : public Object {

View file

@ -601,7 +601,8 @@ public:
}
template<typename U = JS::Value>
explicit(!IsConvertible<U&&, JS::Value>) Optional(U&& value) requires(!IsSame<RemoveCVReference<U>, Optional<JS::Value>> && IsConstructible<JS::Value, U&&>)
explicit(!IsConvertible<U&&, JS::Value>) Optional(U&& value)
requires(!IsSame<RemoveCVReference<U>, Optional<JS::Value>> && IsConstructible<JS::Value, U &&>)
: m_value(forward<U>(value))
{
}