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:
Richard Smith
2023-10-20 20:26:10 +00:00
committed by GitHub
parent e54deee525
commit a46e7dd967
31 changed files with 1240 additions and 957 deletions
+3 -3
View File
@@ -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.