mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
Change NodeIdOneOf and similar to use "requires" and explicit UnsafeMake (#5084)
This doesn't change functionality, but I was seeing better diagnostics in VS Code. This also changes the NodeId constructors for related types (also NodeCategory and NodeIdForKind) to use UnsafeMake for construction. That originated from avoiding ambiguity coming from `requires`, but the constructor mode is also one we should typically avoid (e.g., preferring `Parse::Tree::As`).
This commit is contained in:
@@ -449,8 +449,8 @@ auto Context::AddFunctionDefinitionStart(Lex::TokenIndex token, bool has_error)
|
||||
-> void {
|
||||
if (ParsingInDeferredDefinitionScope(*this)) {
|
||||
deferred_definition_stack_.push_back(tree_->deferred_definitions_.Add(
|
||||
{.start_id =
|
||||
FunctionDefinitionStartId(NodeId(tree_->node_impls_.size()))}));
|
||||
{.start_id = FunctionDefinitionStartId::UnsafeMake(
|
||||
NodeId(tree_->node_impls_.size()))}));
|
||||
}
|
||||
|
||||
AddNode(NodeKind::FunctionDefinitionStart, token, has_error);
|
||||
@@ -462,7 +462,7 @@ auto Context::AddFunctionDefinition(Lex::TokenIndex token, bool has_error)
|
||||
auto definition_index = deferred_definition_stack_.pop_back_val();
|
||||
auto& definition = tree_->deferred_definitions_.Get(definition_index);
|
||||
definition.definition_id =
|
||||
FunctionDefinitionId(NodeId(tree_->node_impls_.size()));
|
||||
FunctionDefinitionId::UnsafeMake(NodeId(tree_->node_impls_.size()));
|
||||
definition.next_definition_index =
|
||||
DeferredDefinitionIndex(tree_->deferred_definitions().size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user