Meta: Enforce newlines around namespaces

This has come up several times during code review, so let's just enforce
it using a new clang-format 20 option.
This commit is contained in:
Timothy Flynn 2025-05-13 07:06:33 -04:00 committed by Andrew Kaster
commit 7280ed6312
Notes: github-actions[bot] 2025-05-14 08:06:48 +00:00
206 changed files with 448 additions and 0 deletions

View file

@ -37,6 +37,7 @@ private:
}
namespace AK {
template<>
class Optional<JS::Bytecode::IdentifierTableIndex> : public OptionalBase<JS::Bytecode::IdentifierTableIndex> {
template<typename U>

View file

@ -51,6 +51,7 @@ struct PropertyKeyAndEnumerableFlag {
}
namespace AK {
template<>
struct Traits<JS::PropertyKeyAndEnumerableFlag> : public DefaultTraits<JS::PropertyKeyAndEnumerableFlag> {
static unsigned hash(JS::PropertyKeyAndEnumerableFlag const& entry)
@ -63,6 +64,7 @@ struct Traits<JS::PropertyKeyAndEnumerableFlag> : public DefaultTraits<JS::Prope
return Traits<JS::PropertyKey>::equals(a.key, b.key);
}
};
}
namespace JS::Bytecode {

View file

@ -27,7 +27,9 @@
#include <LibJS/Runtime/ValueTraits.h>
namespace JS {
class FunctionExpression;
}
namespace JS::Bytecode::Op {

View file

@ -71,6 +71,7 @@ static_assert(sizeof(Operand) == 8);
}
namespace AK {
template<>
class Optional<JS::Bytecode::Operand> : public OptionalBase<JS::Bytecode::Operand> {
template<typename U>

View file

@ -37,6 +37,7 @@ private:
}
namespace AK {
template<>
class Optional<JS::Bytecode::StringTableIndex> : public OptionalBase<JS::Bytecode::StringTableIndex> {
template<typename U>

View file

@ -268,6 +268,7 @@ JS_ENUMERATE_TYPED_ARRAYS
#undef __JS_ENUMERATE
namespace Intl {
#define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \
class ClassName; \
class ConstructorName; \
@ -284,9 +285,11 @@ class Segments;
class SegmentsPrototype;
struct ResolutionOptionDescriptor;
};
namespace Temporal {
#define __JS_ENUMERATE(ClassName, snake_name, ConstructorName, PrototypeName) \
class ClassName; \
class ConstructorName; \
@ -309,6 +312,7 @@ struct PartialDuration;
struct Time;
struct TimeZone;
struct TimeZoneOffset;
};
template<typename T>
@ -316,6 +320,7 @@ requires(!IsLvalueReference<T>)
class ThrowCompletionOr;
namespace Bytecode {
class BasicBlock;
enum class Builtin : u8;
class Executable;
@ -325,6 +330,7 @@ class Interpreter;
class Operand;
class RegexTable;
class Register;
}
}

View file

@ -342,4 +342,5 @@ private:
HashMap<size_t, TokenMemoization> m_token_memoizations;
Program::Type m_program_type;
};
}

View file

@ -1052,12 +1052,15 @@ ErrorOr<void> print_value(JS::PrintContext& print_context, JS::Value value, Hash
TRY(js_out(print_context, "\033[0m"));
return {};
}
}
namespace JS {
ErrorOr<void> print(JS::Value value, PrintContext& print_context)
{
HashTable<JS::Object*> seen_objects;
return print_value(print_context, value, seen_objects);
}
}

View file

@ -12,6 +12,7 @@
#include <LibJS/Runtime/Value.h>
namespace JS {
struct PrintContext {
JS::VM& vm;
Stream& stream;
@ -19,4 +20,5 @@ struct PrintContext {
};
ErrorOr<void> print(JS::Value value, PrintContext&);
}

View file

@ -77,4 +77,5 @@ inline bool Object::fast_is<Error>() const { return is_error_object(); }
DECLARE_NATIVE_ERROR(ClassName, snake_name, PrototypeName, ConstructorName)
JS_ENUMERATE_NATIVE_ERRORS
#undef __JS_ENUMERATE
}

View file

@ -34,6 +34,7 @@ void PromiseCapability::visit_edges(Cell::Visitor& visitor)
}
namespace {
struct ResolvingFunctions final : public Cell {
GC_CELL(ResolvingFunctions, Cell);
GC_DECLARE_ALLOCATOR(ResolvingFunctions);
@ -49,6 +50,7 @@ struct ResolvingFunctions final : public Cell {
}
};
GC_DEFINE_ALLOCATOR(ResolvingFunctions);
}
// 27.2.1.5 NewPromiseCapability ( C ), https://tc39.es/ecma262/#sec-newpromisecapability

View file

@ -13,6 +13,7 @@
#include <LibJS/Runtime/Value.h>
namespace JS {
struct ValueTraits : public Traits<Value> {
static unsigned hash(Value value)
{