Skip to content

Commit 03553e8

Browse files
committed
[SwiftParse] Update for accessor block disambiguation marker
If the block after an pattern binding initializer starts with `{ @_accessorBlock` it's an accessor block, not a trailing closure. rdar://140943107
1 parent cc7888f commit 03553e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SwiftParser/Lookahead.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,12 @@ extension Parser.Lookahead {
274274
var lookahead = self.lookahead()
275275
lookahead.eat(.leftBrace)
276276

277+
// '@_accessorBlock' is a builtin disambiguation marker.
278+
if lookahead.peek(isAt: .identifier),
279+
lookahead.peek().tokenText == "_accessorBlock" {
280+
return true;
281+
}
282+
277283
// Eat attributes, if present.
278284
while lookahead.consume(if: .atSign) != nil {
279285
guard lookahead.consume(if: .identifier) != nil else {

0 commit comments

Comments
 (0)