Remove default constructor from IndexBase (#2598)

There were some notes about default constructors being required in parse_tree.h, but they don't seem to be. Removing the default constructor forces the explicit `::Invalid` where there's no value immediately being assigned, which works fine for existing code. I think this actually reduces the chance of accidents more than the prior default-construct-as-invalid approach.
This commit is contained in:
Jon Ross-Perkins
2023-02-10 12:00:50 -08:00
committed by GitHub
parent aa307b1144
commit b76bc875c4
7 changed files with 28 additions and 30 deletions
@@ -324,10 +324,8 @@ auto SemanticsParseTreeHandler::HandleFunctionDefinitionStart(
auto fn_node =
node_stack_.PopForSoloParseNode(ParseNodeKind::FunctionIntroducer);
SemanticsCallable callable;
callable.param_ir_id = param_ir_id;
callable.param_refs_id = param_refs_id;
auto callable_id = semantics_->AddCallable(callable);
auto callable_id = semantics_->AddCallable(
{.param_ir_id = param_ir_id, .param_refs_id = param_refs_id});
auto decl_id =
AddNode(SemanticsNode::MakeFunctionDeclaration(fn_node, callable_id));
// TODO: Propagate the type of the function.