mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Support declaration modifier keywords (#3412)
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
22dff46ed2
commit
fada410559
@@ -88,6 +88,22 @@ auto Context::AddNode(NodeKind kind, Lex::TokenIndex token, int subtree_start,
|
||||
}
|
||||
}
|
||||
|
||||
auto Context::ReplacePlaceholderNode(int32_t position, NodeKind kind,
|
||||
Lex::TokenIndex token, bool has_error)
|
||||
-> void {
|
||||
CARBON_CHECK(position >= 0 && position < tree_->size())
|
||||
<< "position: " << position << " size: " << tree_->size();
|
||||
auto* node_impl = &tree_->node_impls_[position];
|
||||
CARBON_CHECK(node_impl->subtree_size == 1);
|
||||
CARBON_CHECK(node_impl->kind == NodeKind::Placeholder);
|
||||
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,
|
||||
NodeKind start_kind)
|
||||
-> std::optional<Lex::TokenIndex> {
|
||||
|
||||
Reference in New Issue
Block a user