reader/wgsl: Remove ParserImpl::diagnostics()
Put all errors straight into the ProgramBuilder::Diagnostics()
Fixes a TODO. Kills an assert().
Bug: chromium:1185569
Change-Id: I4e6f3b06106c3cfe75cf2bcdfc56b14ad73e81d9
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/44046
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h
index 2573a0c..e6008a1 100644
--- a/src/reader/wgsl/parser_impl.h
+++ b/src/reader/wgsl/parser_impl.h
@@ -293,20 +293,14 @@
size_t get_max_errors() const { return max_errors_; }
/// @returns true if an error was encountered.
- bool has_error() const { return diags_.contains_errors(); }
+ bool has_error() const { return builder_.Diagnostics().contains_errors(); }
/// @returns the parser error string
std::string error() const {
diag::Formatter formatter{{false, false, false, false}};
- return formatter.format(diags_);
+ return formatter.format(builder_.Diagnostics());
}
- /// @returns the diagnostic messages
- const diag::List& diagnostics() const { return diags_; }
-
- /// @returns the diagnostic messages
- diag::List& diagnostics() { return diags_; }
-
/// @returns the Program. The program builder in the parser will be reset
/// after this.
Program program() { return Program(std::move(builder_)); }
@@ -827,7 +821,6 @@
return builder_.create<T>(std::forward<ARGS>(args)...);
}
- diag::List diags_;
std::unique_ptr<Lexer> lexer_;
std::deque<Token> token_queue_;
bool synchronized_ = true;