Use more specific node kinds for literals. (#3419)

Sounding out the approach, to make it clearer what a literal node
corresponds to.
This commit is contained in:
Jon Ross-Perkins
2023-11-22 01:27:28 +00:00
committed by GitHub
parent f1ddded3a1
commit a204689893
107 changed files with 463 additions and 383 deletions
+5 -1
View File
@@ -298,7 +298,6 @@ class NodeStack {
case Parse::NodeKind::IfExprElse:
case Parse::NodeKind::IndexExpr:
case Parse::NodeKind::InfixOperator:
case Parse::NodeKind::Literal:
case Parse::NodeKind::MemberAccessExpr:
case Parse::NodeKind::NameExpr:
case Parse::NodeKind::ParenExpr:
@@ -314,6 +313,11 @@ class NodeStack {
case Parse::NodeKind::StructFieldType:
case Parse::NodeKind::StructTypeLiteral:
case Parse::NodeKind::TupleLiteral:
// Use x-macros to handle literal cases.
#define CARBON_PARSE_NODE_KIND(...)
#define CARBON_PARSE_NODE_KIND_TOKEN_LITERAL(Name, ...) \
case Parse::NodeKind::Name:
#include "toolchain/parse/node_kind.def"
return IdKind::InstId;
case Parse::NodeKind::IfCondition:
case Parse::NodeKind::IfExprIf: