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
+4 -8
View File
@@ -36,8 +36,8 @@ void Pattern::Print(llvm::raw_ostream& out) const {
const auto& tuple = cast<TuplePattern>(*this);
out << "(";
llvm::ListSeparator sep;
for (const TuplePattern::Field& field : tuple.Fields()) {
out << sep << field.name << " = " << *field.pattern;
for (Nonnull<const Pattern*> field : tuple.Fields()) {
out << sep << *field;
}
out << ")";
break;
@@ -69,9 +69,7 @@ auto TuplePatternFromParenContents(Nonnull<Arena*> arena,
SourceLocation source_loc,
const ParenContents<Pattern>& paren_contents)
-> Nonnull<TuplePattern*> {
return arena->New<TuplePattern>(
source_loc,
paren_contents.TupleElements<TuplePattern::Field>(source_loc));
return arena->New<TuplePattern>(source_loc, paren_contents.elements);
}
// Used by AlternativePattern for constructor initialization. Produces a helpful
@@ -100,9 +98,7 @@ auto ParenExpressionToParenPattern(Nonnull<Arena*> arena,
ParenContents<Pattern> result = {
.elements = {}, .has_trailing_comma = contents.has_trailing_comma};
for (const auto& element : contents.elements) {
result.elements.push_back(
{.name = element.name,
.term = arena->New<ExpressionPattern>(element.term)});
result.elements.push_back(arena->New<ExpressionPattern>(element));
}
return result;
}