diff --git a/src/quick-lint-js/diag/diag-list.cpp b/src/quick-lint-js/diag/diag-list.cpp index 37aa0d961..a8613c0ab 100644 --- a/src/quick-lint-js/diag/diag-list.cpp +++ b/src/quick-lint-js/diag/diag-list.cpp @@ -81,7 +81,8 @@ Span_Size Diag_List::size() const { } bool Diag_List::reported_any_diagnostic_except_since( - std::initializer_list ignored_types, const Rewind_State &r) { + std::initializer_list ignored_types, + const Rewind_State &r) const { for (Node_Base *node = r.last_ == nullptr ? this->first_ : r.last_; node != nullptr; node = node->next) { if (!contains(ignored_types, node->type)) { diff --git a/src/quick-lint-js/diag/diag-list.h b/src/quick-lint-js/diag/diag-list.h index 7d9a3e36f..2e1d52535 100644 --- a/src/quick-lint-js/diag/diag-list.h +++ b/src/quick-lint-js/diag/diag-list.h @@ -70,7 +70,8 @@ class Diag_List { Span_Size size() const; bool reported_any_diagnostic_except_since( - std::initializer_list ignored_types, const Rewind_State &); + std::initializer_list ignored_types, + const Rewind_State &) const; bool have_diagnostic(Diag_Type type) const; // Removes all diagnostics, but does not deallocate memory. diff --git a/src/quick-lint-js/fe/lex.cpp b/src/quick-lint-js/fe/lex.cpp index d06199af2..14f738565 100644 --- a/src/quick-lint-js/fe/lex.cpp +++ b/src/quick-lint-js/fe/lex.cpp @@ -1252,7 +1252,7 @@ void Lexer::roll_back_transaction(Lexer_Transaction&& transaction) { this->last_last_token_end_ = transaction.old_last_last_token_end; this->input_ = transaction.old_input; - this->diag_list_.diags().rewind(std::move(transaction.diag_list_rewind)); + this->diags_.rewind(std::move(transaction.diag_list_rewind)); } bool Lexer::transaction_has_lex_diagnostics(const Lexer_Transaction& transaction) const { diff --git a/src/quick-lint-js/fe/lex.h b/src/quick-lint-js/fe/lex.h index def2d51cc..2428a1755 100644 --- a/src/quick-lint-js/fe/lex.h +++ b/src/quick-lint-js/fe/lex.h @@ -144,12 +144,7 @@ class Lexer { bool test_for_regexp(const Char8* regexp_begin); // Returns all the diagnostics reported so far by the the lexer. - Diag_List& diags() { return this->diag_list_.diags(); } - - // TODO(#1154): Delete. - Diag_List_Diag_Reporter& diag_list_diag_reporter() { - return this->diag_list_; - } + Diag_List& diags() { return this->diags_; } // Save lexer state. // @@ -348,9 +343,7 @@ class Lexer { Monotonic_Allocator allocator_{"lexer::allocator_"}; - Diag_List_Diag_Reporter diag_list_ = - Diag_List_Diag_Reporter(&this->allocator_); - Diag_List& diags_ = diag_list_.diags(); + Diag_List diags_ = Diag_List(&this->allocator_); friend struct Lex_Tables; };