Skip to content

Commit b81c491

Browse files
author
Harlan Haskins
committed
[Lexer] Allow $-prefixed identifiers for parseable interfaces
We’re printing a new name for lazy storage in parseable interfaces, `$__lazy_storage_$_{propname}`. This is intentionally $-prefixed so it cannot conflict with variables written in source, but it doesn’t use a `.` anymore because parseable interfaces need to be...parseable.
1 parent f5fc6f0 commit b81c491

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Parse/Lexer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,11 @@ void Lexer::lexDollarIdent() {
945945
return formToken(tok::identifier, tokStart);
946946
}
947947

948-
// We reserve $nonNumeric for persistent bindings in the debugger.
948+
// We reserve $nonNumeric for persistent bindings in the debugger and implicit
949+
// variables, like storage for lazy properties.
949950
if (!isAllDigits) {
950-
if (!LangOpts.EnableDollarIdentifiers && !InSILBody)
951+
if (!LangOpts.EnableDollarIdentifiers && !InSILBody &&
952+
LexMode != LexerMode::SwiftInterface)
951953
diagnose(tokStart, diag::expected_dollar_numeric);
952954

953955
// Even if we diagnose, we go ahead and form an identifier token,

0 commit comments

Comments
 (0)