Drop support for named tuple fields (#886)

Rationale: Based on the status of #478 and #505, Carbon won't have this feature for a while, and it will be simpler not to support it on spec in the meantime.
This commit is contained in:
Geoff Romer
2021-10-15 13:19:57 -07:00
committed by GitHub
parent c7c653adba
commit bb28d37eed
22 changed files with 175 additions and 469 deletions
+8 -4
View File
@@ -31,8 +31,7 @@ auto ExpressionFromParenContents(
auto TupleExpressionFromParenContents(
Nonnull<Arena*> arena, SourceLocation source_loc,
const ParenContents<Expression>& paren_contents) -> Nonnull<Expression*> {
return arena->New<TupleLiteral>(
source_loc, paren_contents.TupleElements<FieldInitializer>(source_loc));
return arena->New<TupleLiteral>(source_loc, paren_contents.elements);
}
static void PrintOp(llvm::raw_ostream& out, Operator op) {
@@ -85,11 +84,16 @@ void Expression::Print(llvm::raw_ostream& out) const {
out << access.aggregate() << "." << access.field();
break;
}
case Expression::Kind::TupleLiteral:
case Expression::Kind::TupleLiteral: {
out << "(";
PrintFields(out, cast<TupleLiteral>(*this).fields(), " = ");
llvm::ListSeparator sep;
for (Nonnull<const Expression*> field :
cast<TupleLiteral>(*this).fields()) {
out << sep << *field;
}
out << ")";
break;
}
case Expression::Kind::StructLiteral:
out << "{";
PrintFields(out, cast<StructLiteral>(*this).fields(), " = ");