mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST: Implement parsing support for the accepted spelling of @backDeployed for SE-0376.
For source compatibility `@_backDeploy` continues to be accepted as a spelling. rdar://102792909
This commit is contained in:
@@ -1961,14 +1961,14 @@ ParserStatus Parser::parsePlatformVersionInList(StringRef AttrName,
|
||||
return makeParserSuccess();
|
||||
}
|
||||
|
||||
bool Parser::parseBackDeployAttribute(DeclAttributes &Attributes,
|
||||
StringRef AttrName, SourceLoc AtLoc,
|
||||
SourceLoc Loc) {
|
||||
bool Parser::parseBackDeployedAttribute(DeclAttributes &Attributes,
|
||||
StringRef AttrName, SourceLoc AtLoc,
|
||||
SourceLoc Loc) {
|
||||
std::string AtAttrName = (llvm::Twine("@") + AttrName).str();
|
||||
auto LeftLoc = Tok.getLoc();
|
||||
if (!consumeIf(tok::l_paren)) {
|
||||
diagnose(Loc, diag::attr_expected_lparen, AtAttrName,
|
||||
DeclAttribute::isDeclModifier(DAK_BackDeploy));
|
||||
DeclAttribute::isDeclModifier(DAK_BackDeployed));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2019,9 +2019,9 @@ bool Parser::parseBackDeployAttribute(DeclAttributes &Attributes,
|
||||
assert(!PlatformAndVersions.empty());
|
||||
auto AttrRange = SourceRange(Loc, Tok.getLoc());
|
||||
for (auto &Item : PlatformAndVersions) {
|
||||
Attributes.add(new (Context)
|
||||
BackDeployAttr(AtLoc, AttrRange, Item.first, Item.second,
|
||||
/*IsImplicit*/ false));
|
||||
Attributes.add(new (Context) BackDeployedAttr(AtLoc, AttrRange, Item.first,
|
||||
Item.second,
|
||||
/*IsImplicit*/ false));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -3366,8 +3366,8 @@ bool Parser::parseNewDeclAttribute(DeclAttributes &Attributes, SourceLoc AtLoc,
|
||||
message, AtLoc, SourceRange(Loc, Tok.getLoc()), false));
|
||||
break;
|
||||
}
|
||||
case DAK_BackDeploy: {
|
||||
if (!parseBackDeployAttribute(Attributes, AttrName, AtLoc, Loc))
|
||||
case DAK_BackDeployed: {
|
||||
if (!parseBackDeployedAttribute(Attributes, AttrName, AtLoc, Loc))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user