Fix parse to use the error tracking consumer for has_errors_. (#4261)

This is how we are setting has_errors_ in other stages; this should only
make parse consistent.

Fixes #4259
This commit is contained in:
Jon Ross-Perkins
2024-08-28 18:41:36 +00:00
committed by GitHub
parent 702d0d8a53
commit b72826c431
13 changed files with 52 additions and 57 deletions
-9
View File
@@ -69,17 +69,11 @@ Context::Context(Tree& tree, Lex::TokenizedBuffer& tokens,
auto Context::AddLeafNode(NodeKind kind, Lex::TokenIndex token, bool has_error)
-> void {
tree_->node_impls_.push_back(Tree::NodeImpl(kind, has_error, token));
if (has_error) {
tree_->has_errors_ = true;
}
}
auto Context::AddNode(NodeKind kind, Lex::TokenIndex token, bool has_error)
-> void {
tree_->node_impls_.push_back(Tree::NodeImpl(kind, has_error, token));
if (has_error) {
tree_->has_errors_ = true;
}
}
auto Context::ReplacePlaceholderNode(int32_t position, NodeKind kind,
@@ -92,9 +86,6 @@ auto Context::ReplacePlaceholderNode(int32_t position, NodeKind kind,
node_impl->kind = kind;
node_impl->has_error = has_error;
node_impl->token = token;
if (has_error) {
tree_->has_errors_ = true;
}
}
auto Context::ConsumeAndAddOpenParen(Lex::TokenIndex default_token,