[AST] Adjust the API of CaseLabelItem for unknown

Get these simple changes out of the way first. No functionality change.
This commit is contained in:
Jordan Rose
2018-03-28 11:42:54 -07:00
parent e137da5184
commit f26664b1f1
5 changed files with 50 additions and 35 deletions

View File

@@ -268,8 +268,7 @@ deriveBodyCodingKey_enum_stringValue(AbstractFunctionDecl *strValDecl) {
Identifier(), elt, nullptr);
pat->setImplicit();
auto labelItem = CaseLabelItem(/*IsDefault=*/false, pat, SourceLoc(),
nullptr);
auto labelItem = CaseLabelItem(pat);
auto *caseValue = new (C) StringLiteralExpr(elt->getNameStr(),
SourceRange(),
@@ -334,8 +333,7 @@ deriveBodyCodingKey_init_stringValue(AbstractFunctionDecl *initDecl) {
nullptr);
litPat->setImplicit();
auto labelItem = CaseLabelItem(/*IsDefault=*/false, litPat, SourceLoc(),
nullptr);
auto labelItem = CaseLabelItem(litPat);
auto *eltRef = new (C) DeclRefExpr(elt, DeclNameLoc(), /*Implicit=*/true);
auto *metaTyRef = TypeExpr::createImplicit(enumType, C);
@@ -353,8 +351,7 @@ deriveBodyCodingKey_init_stringValue(AbstractFunctionDecl *initDecl) {
auto *anyPat = new (C) AnyPattern(SourceLoc());
anyPat->setImplicit();
auto dfltLabelItem = CaseLabelItem(/*IsDefault=*/true, anyPat, SourceLoc(),
nullptr);
auto dfltLabelItem = CaseLabelItem::getDefault(anyPat);
auto *dfltReturnStmt = new (C) FailStmt(SourceLoc(), SourceLoc());
auto *dfltBody = BraceStmt::create(C, SourceLoc(), ASTNode(dfltReturnStmt),