Skip to content

Commit 05abdad

Browse files
committed
Parse #isolation as CurrentContextIsolationExpr when we don't have swift-syntax
When building without swift-syntax, we don't have the ability to handle macros. However, the concurrency runtime makes use of `#isolation` in a number of places. To continue supporting building without swift-syntax, parse `#isolation` directly into the otherwise-unspellable CurrentContextIsolationExpr but *only* when swift-syntax is not available.
1 parent 6a3ffb0 commit 05abdad

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/Parse/ParseExpr.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3454,6 +3454,20 @@ ParserResult<Expr> Parser::parseExprMacroExpansion(bool isExprBasic) {
34543454
if (!macroNameRef)
34553455
return status;
34563456

3457+
#if !SWIFT_BUILD_SWIFT_SYNTAX
3458+
// If we don't have swift-syntax and therefore have no support for macros,
3459+
// recognize #isolation as special and route it through
3460+
// CurrentContextIsolationExpr.
3461+
if (macroNameRef.getBaseName().userFacingName() == "isolation" &&
3462+
genericArgs.empty() &&
3463+
(!argList || argList->empty())) {
3464+
return makeParserResult(
3465+
status,
3466+
new (Context) CurrentContextIsolationExpr(
3467+
macroNameLoc.getStartLoc(), Type()));
3468+
}
3469+
#endif
3470+
34573471
return makeParserResult(
34583472
status,
34593473
MacroExpansionExpr::create(

0 commit comments

Comments
 (0)