mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 07:21:04 +01:00
Change struct literal parsing to use placeholders. (#3850)
This is achieving a similar goal as #3849, using placeholders instead of an ambiguous start node to clarify structure and incrementally simplify checking. The benefit isn't quite as big here because both paths are structs, and so checking is more consistent than paren exprs versus tuples. But I think this removes the only other multi-purpose parse node. This uses StructLiteral/StructTypeLiteral naming, reflecting equivalent SemIR naming. Note, I would lean towards renaming StructLiteral to StructValueLiteral, but I think consistency in naming takes precedence. Any renames of StructLiteral might be better in a separate PR. StructFieldType/StructFieldValue -> StructTypeField/StructField is trying to making the reading more consistent with StructTypeLiteral/StructLiteral. SemIR has StructTypeField but not a value equivalent.
This commit is contained in:
@@ -412,8 +412,8 @@ class NodeStack {
|
||||
case Parse::NodeKind::ReturnType:
|
||||
case Parse::NodeKind::ShortCircuitOperandAnd:
|
||||
case Parse::NodeKind::ShortCircuitOperandOr:
|
||||
case Parse::NodeKind::StructFieldValue:
|
||||
case Parse::NodeKind::StructFieldType:
|
||||
case Parse::NodeKind::StructField:
|
||||
case Parse::NodeKind::StructTypeField:
|
||||
return Id::KindFor<SemIR::InstId>();
|
||||
case Parse::NodeKind::IfCondition:
|
||||
case Parse::NodeKind::IfExprIf:
|
||||
@@ -445,12 +445,12 @@ class NodeStack {
|
||||
case Parse::NodeKind::InterfaceIntroducer:
|
||||
case Parse::NodeKind::LetInitializer:
|
||||
case Parse::NodeKind::LetIntroducer:
|
||||
case Parse::NodeKind::ParenExprStart:
|
||||
case Parse::NodeKind::QualifiedName:
|
||||
case Parse::NodeKind::ReturnedModifier:
|
||||
case Parse::NodeKind::ReturnStatementStart:
|
||||
case Parse::NodeKind::ReturnVarModifier:
|
||||
case Parse::NodeKind::StructLiteralOrStructTypeLiteralStart:
|
||||
case Parse::NodeKind::StructLiteralStart:
|
||||
case Parse::NodeKind::StructTypeLiteralStart:
|
||||
case Parse::NodeKind::TupleLiteralStart:
|
||||
case Parse::NodeKind::TuplePatternStart:
|
||||
case Parse::NodeKind::VariableInitializer:
|
||||
|
||||
Reference in New Issue
Block a user