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
+7 -6
View File
@@ -92,8 +92,7 @@ auto TupleExpressionFromParenContents(
Nonnull<Arena*> arena, SourceLocation source_loc,
const ParenContents<Expression>& paren_contents) -> Nonnull<Expression*>;
// A FieldInitializer represents the initialization of a single tuple or
// struct field.
// A FieldInitializer represents the initialization of a single struct field.
class FieldInitializer {
public:
FieldInitializer(std::string name, Nonnull<Expression*> expression)
@@ -247,7 +246,7 @@ class TupleLiteral : public Expression {
: TupleLiteral(source_loc, {}) {}
explicit TupleLiteral(SourceLocation source_loc,
std::vector<FieldInitializer> fields)
std::vector<Nonnull<Expression*>> fields)
: Expression(Kind::TupleLiteral, source_loc),
fields_(std::move(fields)) {}
@@ -255,11 +254,13 @@ class TupleLiteral : public Expression {
return exp->kind() == Kind::TupleLiteral;
}
auto fields() const -> llvm::ArrayRef<FieldInitializer> { return fields_; }
auto fields() -> llvm::MutableArrayRef<FieldInitializer> { return fields_; }
auto fields() const -> llvm::ArrayRef<Nonnull<const Expression*>> {
return fields_;
}
auto fields() -> llvm::ArrayRef<Nonnull<Expression*>> { return fields_; }
private:
std::vector<FieldInitializer> fields_;
std::vector<Nonnull<Expression*>> fields_;
};
// A non-empty literal value of a struct type.