mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
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:
@@ -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(), " = ");
|
||||
|
||||
Reference in New Issue
Block a user