mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 06:21:04 +01:00
Remove most of the metaprogramming in node.h in favor of listing all the members in the typed node structs. (#3310)
Split `node.h` into separate files for ID types (`id.h`) and for typed nodes (`typed_nodes.h`). The per-node-kind data is now specified as part of declaring the typed nodes, and is removed from the node kinds x-macros, which now simply enumerate the node kinds.
This commit is contained in:
@@ -20,7 +20,7 @@ auto HandleBreakStatementStart(Context& context, Parse::Node parse_node)
|
||||
"`break` can only be used in a loop.");
|
||||
context.emitter().Emit(parse_node, BreakOutsideLoop);
|
||||
} else {
|
||||
context.AddNode(SemIR::Branch(parse_node, stack.back().break_target));
|
||||
context.AddNode(SemIR::Branch{parse_node, stack.back().break_target});
|
||||
}
|
||||
|
||||
context.node_block_stack().Pop();
|
||||
@@ -41,7 +41,7 @@ auto HandleContinueStatementStart(Context& context, Parse::Node parse_node)
|
||||
"`continue` can only be used in a loop.");
|
||||
context.emitter().Emit(parse_node, ContinueOutsideLoop);
|
||||
} else {
|
||||
context.AddNode(SemIR::Branch(parse_node, stack.back().continue_target));
|
||||
context.AddNode(SemIR::Branch{parse_node, stack.back().continue_target});
|
||||
}
|
||||
|
||||
context.node_block_stack().Pop();
|
||||
@@ -111,7 +111,7 @@ auto HandleWhileStatement(Context& context, Parse::Node parse_node) -> bool {
|
||||
context.break_continue_stack().pop_back();
|
||||
|
||||
// Add the loop backedge.
|
||||
context.AddNode(SemIR::Branch(parse_node, loop_header_id));
|
||||
context.AddNode(SemIR::Branch{parse_node, loop_header_id});
|
||||
context.node_block_stack().Pop();
|
||||
|
||||
// Start emitting the loop exit block.
|
||||
|
||||
Reference in New Issue
Block a user