Skip to content

Commit c780347

Browse files
committed
refactor: rename UpperCamelCase -> Upper_Snake_Case
Change the name of type template parameters to match the style described in ADR018.
1 parent 309863e commit c780347

File tree

19 files changed

+96
-96
lines changed

19 files changed

+96
-96
lines changed

benchmark/benchmark-lsp/lsp-server-process.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,21 +304,21 @@ LSP_Server_Process::wait_for_diagnostics_ignoring_async(
304304
/*messages_to_ignore=*/messages_to_ignore);
305305
}
306306

307-
template <class ParamsPredicate>
307+
template <class Params_Predicate>
308308
LSP_Task<::boost::json::array> LSP_Server_Process::wait_for_diagnostics_async(
309-
ParamsPredicate&& predicate) {
309+
Params_Predicate&& predicate) {
310310
return this->wait_for_diagnostics_ignoring_async(
311-
std::forward<ParamsPredicate>(predicate),
311+
std::forward<Params_Predicate>(predicate),
312312
/*messages_to_ignore=*/this->diagnostics_messages_to_ignore_);
313313
}
314314

315-
template <class ParamsPredicate>
315+
template <class Params_Predicate>
316316
LSP_Task<::boost::json::array>
317317
LSP_Server_Process::wait_for_diagnostics_ignoring_async(
318-
ParamsPredicate&& predicate, std::int64_t messages_to_ignore) {
318+
Params_Predicate&& predicate, std::int64_t messages_to_ignore) {
319319
::boost::json::object notification =
320320
co_await this->wait_for_diagnostics_notification_async(
321-
std::forward<ParamsPredicate>(predicate),
321+
std::forward<Params_Predicate>(predicate),
322322
/*messages_to_ignore=*/messages_to_ignore);
323323
co_return look_up(notification, "params", "diagnostics").get_array();
324324
}
@@ -329,19 +329,19 @@ LSP_Server_Process::wait_for_diagnostics_notification_async() {
329329
[]([[maybe_unused]] ::boost::json::object& params) { return true; });
330330
}
331331

332-
template <class ParamsPredicate>
332+
template <class Params_Predicate>
333333
LSP_Task<::boost::json::object>
334334
LSP_Server_Process::wait_for_diagnostics_notification_async(
335-
ParamsPredicate&& predicate) {
335+
Params_Predicate&& predicate) {
336336
return this->wait_for_diagnostics_notification_async(
337-
std::forward<ParamsPredicate>(predicate),
337+
std::forward<Params_Predicate>(predicate),
338338
/*messages_to_ignore=*/this->diagnostics_messages_to_ignore_);
339339
}
340340

341-
template <class ParamsPredicate>
341+
template <class Params_Predicate>
342342
LSP_Task<::boost::json::object>
343343
LSP_Server_Process::wait_for_diagnostics_notification_async(
344-
ParamsPredicate&& predicate, std::int64_t messages_to_ignore) {
344+
Params_Predicate&& predicate, std::int64_t messages_to_ignore) {
345345
for (std::int64_t i = 0; i < messages_to_ignore; ++i) {
346346
co_await this->wait_for_first_diagnostics_notification_async(predicate);
347347
}
@@ -355,10 +355,10 @@ LSP_Server_Process::wait_for_first_diagnostics_notification_async() {
355355
[]([[maybe_unused]] ::boost::json::object& params) { return true; });
356356
}
357357

358-
template <class ParamsPredicate>
358+
template <class Params_Predicate>
359359
LSP_Task<::boost::json::object>
360360
LSP_Server_Process::wait_for_first_diagnostics_notification_async(
361-
ParamsPredicate&& predicate) {
361+
Params_Predicate&& predicate) {
362362
for (;;) {
363363
::boost::json::object message =
364364
(co_await this->get_message_async()).as_object();

benchmark/benchmark-lsp/quick-lint-js/lsp-server-process.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,30 +253,30 @@ class LSP_Server_Process {
253253
std::int64_t document_version, std::int64_t messages_to_ignore);
254254
LSP_Task<::boost::json::array> wait_for_diagnostics_async(
255255
String8_View document_uri, std::int64_t document_version);
256-
template <class ParamsPredicate>
257-
LSP_Task<::boost::json::array> wait_for_diagnostics_async(ParamsPredicate&&);
258-
template <class ParamsPredicate>
256+
template <class Params_Predicate>
257+
LSP_Task<::boost::json::array> wait_for_diagnostics_async(Params_Predicate&&);
258+
template <class Params_Predicate>
259259
LSP_Task<::boost::json::array> wait_for_diagnostics_ignoring_async(
260-
ParamsPredicate&&, std::int64_t messages_to_ignore);
260+
Params_Predicate&&, std::int64_t messages_to_ignore);
261261

262262
// Returns the entire notification object.
263263
// Respects diagnosticsMessagesToIgnore.
264264
LSP_Task<::boost::json::object> wait_for_diagnostics_notification_async();
265-
template <class ParamsPredicate>
265+
template <class Params_Predicate>
266266
LSP_Task<::boost::json::object> wait_for_diagnostics_notification_async(
267-
ParamsPredicate&&);
268-
template <class ParamsPredicate>
267+
Params_Predicate&&);
268+
template <class Params_Predicate>
269269
LSP_Task<::boost::json::object> wait_for_diagnostics_notification_async(
270-
ParamsPredicate&&, std::int64_t messages_to_ignore);
270+
Params_Predicate&&, std::int64_t messages_to_ignore);
271271

272272
// Returns the entire notification object.
273273
// Does not respect diagnosticsMessagesToIgnore; returns the first matching
274274
// message.
275275
LSP_Task<::boost::json::object>
276276
wait_for_first_diagnostics_notification_async();
277-
template <class ParamsPredicate>
277+
template <class Params_Predicate>
278278
LSP_Task<::boost::json::object> wait_for_first_diagnostics_notification_async(
279-
ParamsPredicate&&);
279+
Params_Predicate&&);
280280

281281
void send_message(Byte_Buffer&& message);
282282

src/quick-lint-js/container/async-byte-queue.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class Async_Byte_Queue {
6666
String8 take_committed_string8();
6767

6868
// Reader thread only.
69-
template <class ChunkFunc, class FinalizeFunc>
70-
void take_committed(ChunkFunc&& chunk_callback,
71-
FinalizeFunc&& finalize_callback);
69+
template <class Chunk_Func, class Finalize_Func>
70+
void take_committed(Chunk_Func&& chunk_callback,
71+
Finalize_Func&& finalize_callback);
7272

7373
private:
7474
struct alignas(alignof(Max_Align_T)) Chunk {
@@ -143,9 +143,9 @@ class Async_Byte_Queue {
143143
};
144144

145145
// Reader thread only.
146-
template <class ChunkFunc, class FinalizeFunc>
147-
void Async_Byte_Queue::take_committed(ChunkFunc&& chunk_callback,
148-
FinalizeFunc&& finalize_callback) {
146+
template <class Chunk_Func, class Finalize_Func>
147+
void Async_Byte_Queue::take_committed(Chunk_Func&& chunk_callback,
148+
Finalize_Func&& finalize_callback) {
149149
Chunk* first_chunk = this->reader_chunk_;
150150
Chunk* last_chunk;
151151
{

src/quick-lint-js/container/heap-function.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <utility>
99

1010
namespace quick_lint_js {
11-
template <class FuncType>
11+
template <class Func_Type>
1212
class Heap_Function;
1313

1414
// heap_function is like std::function but with a few differences:

src/quick-lint-js/container/vector.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ class Uninstrumented_Vector : private Vector {
8686

8787
using Bump_Vector_Size = std::ptrdiff_t;
8888

89-
template <class T, class BumpAllocator>
89+
template <class T, class Bump_Allocator>
9090
class Raw_Bump_Vector {
9191
public:
9292
using value_type = T;
93-
using allocator_type = BumpAllocator *;
93+
using allocator_type = Bump_Allocator *;
9494
using size_type = Bump_Vector_Size;
9595
using difference_type = Bump_Vector_Size;
9696
using reference = T &;
@@ -102,7 +102,7 @@ class Raw_Bump_Vector {
102102

103103
static_assert(is_winkable_v<T>);
104104

105-
explicit Raw_Bump_Vector(BumpAllocator *allocator) noexcept
105+
explicit Raw_Bump_Vector(Bump_Allocator *allocator) noexcept
106106
: allocator_(allocator) {}
107107

108108
Raw_Bump_Vector(const Raw_Bump_Vector &) = delete;
@@ -120,7 +120,7 @@ class Raw_Bump_Vector {
120120

121121
~Raw_Bump_Vector() { this->clear(); }
122122

123-
BumpAllocator *get_allocator() const noexcept { return this->allocator_; }
123+
Bump_Allocator *get_allocator() const noexcept { return this->allocator_; }
124124

125125
bool empty() const noexcept { return this->data_ == this->data_end_; }
126126
size_type size() const noexcept {
@@ -300,15 +300,15 @@ class Raw_Bump_Vector {
300300
T *data_end_ = nullptr;
301301
T *capacity_end_ = nullptr;
302302

303-
BumpAllocator *allocator_;
303+
Bump_Allocator *allocator_;
304304
};
305305

306306
#if QLJS_FEATURE_VECTOR_PROFILING
307-
template <class T, class BumpAllocator>
308-
using Bump_Vector = Instrumented_Vector<Raw_Bump_Vector<T, BumpAllocator>>;
307+
template <class T, class Bump_Allocator>
308+
using Bump_Vector = Instrumented_Vector<Raw_Bump_Vector<T, Bump_Allocator>>;
309309
#else
310-
template <class T, class BumpAllocator>
311-
using Bump_Vector = Uninstrumented_Vector<Raw_Bump_Vector<T, BumpAllocator>>;
310+
template <class T, class Bump_Allocator>
311+
using Bump_Vector = Uninstrumented_Vector<Raw_Bump_Vector<T, Bump_Allocator>>;
312312
#endif
313313
}
314314

src/quick-lint-js/diag/diagnostic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const Diagnostic_Info &get_diagnostic_info(Diag_Type) noexcept;
9797
std::optional<Diag_Type> diag_type_from_code_slow(
9898
std::string_view code) noexcept;
9999

100-
template <class ArgType>
100+
template <class Arg_Type>
101101
constexpr Diagnostic_Arg_Type get_diagnostic_message_arg_type() noexcept;
102102
template <>
103103
constexpr Diagnostic_Arg_Type

src/quick-lint-js/fe/parse.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ void Parser::check_body_after_label() {
707707
this->error_on_lexical_declaration(Statement_Kind::labelled_statement);
708708
}
709709

710-
template <class MissingSemicolonDiagnostic>
710+
template <class Missing_Semicolon_Diagnostic>
711711
void Parser::consume_semicolon() {
712712
switch (this->peek().type) {
713713
case Token_Type::semicolon:
@@ -723,7 +723,7 @@ void Parser::consume_semicolon() {
723723
} else {
724724
this->lexer_.insert_semicolon();
725725
this->diag_reporter_->report(
726-
MissingSemicolonDiagnostic{this->peek().span()});
726+
Missing_Semicolon_Diagnostic{this->peek().span()});
727727
this->skip();
728728
}
729729
break;

src/quick-lint-js/fe/parse.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class Parser {
446446

447447
void parse_and_visit_with(Parse_Visitor_Base &v);
448448

449-
template <class ExpectedParenthesesError, class ExpectedParenthesisError,
449+
template <class Expected_Parentheses_Error, class Expected_Parenthesis_Error,
450450
bool CheckForSketchyConditions, bool CheckForCommaOperator>
451451
void parse_and_visit_parenthesized_expression(Parse_Visitor_Base &v,
452452
Source_Code_Span token);
@@ -749,7 +749,7 @@ class Parser {
749749
Expression *lhs);
750750

751751
void consume_semicolon_after_statement();
752-
template <class MissingSemicolonDiagnostic>
752+
template <class Missing_Semicolon_Diagnostic>
753753
void consume_semicolon();
754754

755755
void error_on_pointless_nullish_coalescing_operator(
@@ -808,8 +808,8 @@ class Parser {
808808
//
809809
// When try_func and catch_func are called, they start with the same lexer
810810
// state.
811-
template <class TryFunc, class CatchFunc>
812-
void try_parse(TryFunc &&try_func, CatchFunc &&catch_func) {
811+
template <class Try_Func, class Catch_Func>
812+
void try_parse(Try_Func &&try_func, Catch_Func &&catch_func) {
813813
Parser_Transaction transaction = this->begin_transaction();
814814
bool should_commit = std::move(try_func)();
815815
if (should_commit) {
@@ -1078,7 +1078,7 @@ class Parser {
10781078
Parse_Visitor_Base &v, const TypeScript_Declare_Context &declare_context);
10791079
};
10801080

1081-
template <class ExpectedParenthesesError, class ExpectedParenthesisError,
1081+
template <class Expected_Parentheses_Error, class Expected_Parenthesis_Error,
10821082
bool CheckForSketchyConditions, bool CheckForCommaOperator>
10831083
void Parser::parse_and_visit_parenthesized_expression(
10841084
Parse_Visitor_Base &v, Source_Code_Span token_span) {
@@ -1116,15 +1116,15 @@ void Parser::parse_and_visit_parenthesized_expression(
11161116
}
11171117

11181118
if (!have_expression_left_paren && !have_expression_right_paren) {
1119-
this->diag_reporter_->report(ExpectedParenthesesError{
1119+
this->diag_reporter_->report(Expected_Parentheses_Error{
11201120
Source_Code_Span(expression_begin, expression_end)});
11211121
} else if (!have_expression_right_paren) {
1122-
this->diag_reporter_->report(ExpectedParenthesisError{
1122+
this->diag_reporter_->report(Expected_Parenthesis_Error{
11231123
.where = Source_Code_Span::unit(expression_end),
11241124
.token = ')',
11251125
});
11261126
} else if (!have_expression_left_paren) {
1127-
this->diag_reporter_->report(ExpectedParenthesisError{
1127+
this->diag_reporter_->report(Expected_Parenthesis_Error{
11281128
.where = Source_Code_Span::unit(expression_begin),
11291129
.token = '(',
11301130
});

src/quick-lint-js/fe/variable-analyzer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,12 +852,12 @@ void Variable_Analyzer::report_error_if_assignment_is_illegal(
852852
}
853853
}
854854

855-
template <class DeclaredVariableType>
855+
template <class Declared_Variable_Type>
856856
void Variable_Analyzer::report_errors_for_variable_use(
857-
const Used_Variable &used_var, const DeclaredVariableType &declared,
857+
const Used_Variable &used_var, const Declared_Variable_Type &declared,
858858
bool use_is_before_declaration) const {
859859
constexpr bool declared_in_global_scope =
860-
std::is_same_v<DeclaredVariableType, Global_Declared_Variable>;
860+
std::is_same_v<Declared_Variable_Type, Global_Declared_Variable>;
861861

862862
if (used_var.kind == Used_Variable_Kind::assignment) {
863863
this->report_error_if_assignment_is_illegal(

src/quick-lint-js/fe/variable-analyzer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ class Variable_Analyzer final : public Parse_Visitor_Base {
279279
const Identifier *declaration, const Identifier &assignment,
280280
bool is_assigned_before_declaration) const;
281281

282-
template <class DeclaredVariableType>
282+
template <class Declared_Variable_Type>
283283
void report_errors_for_variable_use(const Used_Variable &,
284-
const DeclaredVariableType &,
284+
const Declared_Variable_Type &,
285285
bool use_is_before_declaration) const;
286286

287287
void report_error_if_variable_declaration_conflicts_in_scope(

0 commit comments

Comments
 (0)