Skip to content

Commit dcee673

Browse files
authored
Merge pull request swiftlang#74522 from mateusrodriguesxyz/trailing-comma
2 parents 3c066a8 + ac57e61 commit dcee673

14 files changed

+531
-216
lines changed

include/swift/Basic/Features.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,9 @@ EXPERIMENTAL_FEATURE(SE427NoInferenceOnExtension, true)
398398

399399
EXPERIMENTAL_FEATURE(Extern, true)
400400

401+
// Enable trailing comma for comma-separated lists.
402+
EXPERIMENTAL_FEATURE(TrailingComma, false)
403+
401404
#undef EXPERIMENTAL_FEATURE_EXCLUDED_FROM_MODULE_INTERFACE
402405
#undef EXPERIMENTAL_FEATURE
403406
#undef UPCOMING_FEATURE

include/swift/Parse/Parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,6 +1986,8 @@ class Parser {
19861986
/// expression can be parsed.
19871987
bool isStartOfStmt(bool preferExpr);
19881988

1989+
bool isStartOfConditionalStmtBody();
1990+
19891991
bool isTerminatorForBraceItemListKind(BraceItemListKind Kind,
19901992
ArrayRef<ASTNode> ParsedDecls);
19911993
ParserResult<Stmt> parseStmt(bool fromASTGen = false);

lib/AST/FeatureSet.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ UNINTERESTING_FEATURE(Sensitive)
224224
UNINTERESTING_FEATURE(DebugDescriptionMacro)
225225
UNINTERESTING_FEATURE(ReinitializeConsumeInMultiBlockDefer)
226226
UNINTERESTING_FEATURE(SE427NoInferenceOnExtension)
227+
UNINTERESTING_FEATURE(TrailingComma)
227228

228229
// ----------------------------------------------------------------------------
229230
// MARK: - FeatureSet

lib/ASTGen/Sources/ASTGen/SourceFile.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ extension Parser.ExperimentalFeatures {
6767
mapFeature(.DoExpressions, to: .doExpressions)
6868
mapFeature(.NonescapableTypes, to: .nonescapableTypes)
6969
mapFeature(.SendingArgsAndResults, to: .sendingArgsAndResults)
70+
mapFeature(.TrailingComma, to: .trailingComma)
7071
}
7172
}
7273

0 commit comments

Comments
 (0)