mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 11:01:05 +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:
@@ -44,9 +44,9 @@ auto FunctionContext::LowerBlock(SemIR::NodeBlockId block_id) -> void {
|
||||
// clang warns on unhandled enum values; clang-tidy is incorrect here.
|
||||
// NOLINTNEXTLINE(bugprone-switch-missing-default-case)
|
||||
switch (node.kind()) {
|
||||
#define CARBON_SEMANTICS_NODE_KIND(Name) \
|
||||
case SemIR::NodeKind::Name: \
|
||||
Handle##Name(*this, node_id, node); \
|
||||
#define CARBON_SEMANTICS_NODE_KIND(Name) \
|
||||
case SemIR::NodeKind::Name: \
|
||||
Handle##Name(*this, node_id, node.As<SemIR::Name>()); \
|
||||
break;
|
||||
#include "toolchain/sem_ir/node_kind.def"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user