Skip to content

Commit 0271b66

Browse files
author
Davide Italiano
committed
[DebuggerSupport] Unbreak closures in the expression parser.
The new trick is that of leavign an unresolved identifier for the expression parser to fill in. <rdar://problem/47982630>
1 parent e2c6e8e commit 0271b66

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/Parse/Lexer.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,6 @@ void Lexer::lexDollarIdent() {
953953
// independent of language mode.
954954
return formToken(tok::identifier, tokStart);
955955
} else {
956-
if (LangOpts.EnableDollarIdentifiers && !LangOpts.Playground)
957-
return formToken(tok::identifier, tokStart);
958956
return formToken(tok::dollarident, tokStart);
959957
}
960958
}

lib/Parse/ParseExpr.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2915,6 +2915,12 @@ Expr *Parser::parseExprAnonClosureArg() {
29152915
auto closure = dyn_cast_or_null<ClosureExpr>(
29162916
dyn_cast<AbstractClosureExpr>(CurDeclContext));
29172917
if (!closure) {
2918+
if (Context.LangOpts.DebuggerSupport) {
2919+
auto refKind = DeclRefKind::Ordinary;
2920+
auto identifier = Context.getIdentifier(Name);
2921+
return new (Context) UnresolvedDeclRefExpr(DeclName(identifier), refKind,
2922+
DeclNameLoc(Loc));
2923+
}
29182924
diagnose(Loc, diag::anon_closure_arg_not_in_closure);
29192925
return new (Context) ErrorExpr(Loc);
29202926
}

0 commit comments

Comments
 (0)