Parse concurrency syntax when parsing for syntax-tree-only mode.

This allows the syntax parser library and SwiftSyntax to successfully
parse code using this experimental feature without requiring an API
to pass compiler flags into the parser.
This commit is contained in:
Tony Allevato
2020-08-11 14:07:41 -07:00
parent f86b95194b
commit db2dd20ce6
6 changed files with 47 additions and 13 deletions

View File

@@ -824,7 +824,7 @@ Parser::parseFunctionSignature(Identifier SimpleName,
void Parser::parseAsyncThrows(
SourceLoc existingArrowLoc, SourceLoc &asyncLoc, SourceLoc &throwsLoc,
bool *rethrows) {
if (Context.LangOpts.EnableExperimentalConcurrency &&
if (shouldParseExperimentalConcurrency() &&
Tok.isContextualKeyword("async")) {
asyncLoc = consumeToken();
@@ -857,7 +857,7 @@ void Parser::parseAsyncThrows(
.fixItInsert(existingArrowLoc, (keyword + " ").str());
}
if (Context.LangOpts.EnableExperimentalConcurrency &&
if (shouldParseExperimentalConcurrency() &&
Tok.isContextualKeyword("async")) {
asyncLoc = consumeToken();