mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Add typed nodes to SemIR. (#3280)
Replace `SemIR::Node::GetAsFoo` and `SemIR::Node::Foo::Make` with `SemIR::Foo` class that represents a particular kind of node, with named fields. Rename `SemIR::IntegerLiteral` and `SemIR::RealLiteral` to `IntegerValue` / `RealValue` to better reflect their purpose and avoid a name collision with the corresponding `SemIR` node kinds. Remove `NodeKind::Invalid` and the `SemIR::Node` default constructor entirely, as they were not used for anything.
This commit is contained in:
@@ -32,12 +32,12 @@ auto HandlePatternBinding(Context& context, Parse::Node parse_node) -> bool {
|
||||
switch (auto context_parse_node_kind = context.parse_tree().node_kind(
|
||||
context.node_stack().PeekParseNode())) {
|
||||
case Parse::NodeKind::VariableIntroducer:
|
||||
context.AddNodeAndPush(parse_node, SemIR::Node::VarStorage::Make(
|
||||
name_node, cast_type_id, name_id));
|
||||
context.AddNodeAndPush(
|
||||
parse_node, SemIR::VarStorage(name_node, cast_type_id, name_id));
|
||||
break;
|
||||
case Parse::NodeKind::ParameterListStart:
|
||||
context.AddNodeAndPush(parse_node, SemIR::Node::Parameter::Make(
|
||||
name_node, cast_type_id, name_id));
|
||||
context.AddNodeAndPush(
|
||||
parse_node, SemIR::Parameter(name_node, cast_type_id, name_id));
|
||||
break;
|
||||
case Parse::NodeKind::LetIntroducer:
|
||||
// Create the node, but don't add it to a block until after we've formed
|
||||
@@ -46,7 +46,7 @@ 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::Node::BindName::Make(
|
||||
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