mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 22:02:51 +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:
@@ -44,14 +44,14 @@ auto HandlePatternBinding(Context& context, Parse::Node parse_node) -> bool {
|
||||
cast_type_id = SemIR::TypeId::Error;
|
||||
}
|
||||
context.AddNodeAndPush(
|
||||
parse_node, SemIR::VarStorage(name_node, cast_type_id, name_id));
|
||||
parse_node, SemIR::VarStorage{name_node, cast_type_id, name_id});
|
||||
break;
|
||||
|
||||
case Parse::NodeKind::ParameterListStart:
|
||||
// Parameters can have incomplete types in a function declaration, but not
|
||||
// in a function definition. We don't know which kind we have here.
|
||||
context.AddNodeAndPush(
|
||||
parse_node, SemIR::Parameter(name_node, cast_type_id, name_id));
|
||||
parse_node, SemIR::Parameter{name_node, cast_type_id, name_id});
|
||||
break;
|
||||
|
||||
case Parse::NodeKind::LetIntroducer:
|
||||
@@ -71,8 +71,8 @@ auto HandlePatternBinding(Context& context, Parse::Node parse_node) -> bool {
|
||||
// the `let` pattern before we see the initializer.
|
||||
context.node_stack().Push(
|
||||
parse_node,
|
||||
context.semantics_ir().AddNodeInNoBlock(SemIR::BindName(
|
||||
name_node, cast_type_id, name_id, SemIR::NodeId::Invalid)));
|
||||
context.semantics_ir().AddNodeInNoBlock(SemIR::BindName{
|
||||
name_node, cast_type_id, name_id, SemIR::NodeId::Invalid}));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user