@@ -1505,6 +1505,7 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable {
1505
1505
enum Cursor : Int {
1506
1506
case capture
1507
1507
case input
1508
+ case asyncKeyword
1508
1509
case throwsTok
1509
1510
case output
1510
1511
case inTok
@@ -1575,6 +1576,28 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable {
1575
1576
return ClosureSignatureSyntax ( newData)
1576
1577
}
1577
1578
1579
+ public var asyncKeyword : TokenSyntax ? {
1580
+ get {
1581
+ let childData = data. child ( at: Cursor . asyncKeyword,
1582
+ parent: Syntax ( self ) )
1583
+ if childData == nil { return nil }
1584
+ return TokenSyntax ( childData!)
1585
+ }
1586
+ set ( value) {
1587
+ self = withAsyncKeyword ( value)
1588
+ }
1589
+ }
1590
+
1591
+ /// Returns a copy of the receiver with its `asyncKeyword` replaced.
1592
+ /// - param newChild: The new `asyncKeyword` to replace the node's
1593
+ /// current `asyncKeyword`, if present.
1594
+ public func withAsyncKeyword(
1595
+ _ newChild: TokenSyntax ? ) -> ClosureSignatureSyntax {
1596
+ let raw = newChild? . raw
1597
+ let newData = data. replacingChild ( raw, at: Cursor . asyncKeyword)
1598
+ return ClosureSignatureSyntax ( newData)
1599
+ }
1600
+
1578
1601
public var throwsTok : TokenSyntax ? {
1579
1602
get {
1580
1603
let childData = data. child ( at: Cursor . throwsTok,
@@ -1643,7 +1666,7 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable {
1643
1666
1644
1667
public func _validateLayout( ) {
1645
1668
let rawChildren = Array ( RawSyntaxChildren ( Syntax ( self ) ) )
1646
- assert ( rawChildren. count == 5 )
1669
+ assert ( rawChildren. count == 6 )
1647
1670
// Check child #0 child is ClosureCaptureSignatureSyntax or missing
1648
1671
if let raw = rawChildren [ 0 ] . raw {
1649
1672
let info = rawChildren [ 0 ] . syntaxInfo
@@ -1668,21 +1691,29 @@ public struct ClosureSignatureSyntax: SyntaxProtocol, SyntaxHashable {
1668
1691
let syntaxChild = Syntax ( syntaxData)
1669
1692
assert ( syntaxChild. is ( TokenSyntax . self) )
1670
1693
}
1671
- // Check child #3 child is ReturnClauseSyntax or missing
1694
+ // Check child #3 child is TokenSyntax or missing
1672
1695
if let raw = rawChildren [ 3 ] . raw {
1673
1696
let info = rawChildren [ 3 ] . syntaxInfo
1674
1697
let absoluteRaw = AbsoluteRawSyntax ( raw: raw, info: info)
1675
1698
let syntaxData = SyntaxData ( absoluteRaw, parent: Syntax ( self ) )
1676
1699
let syntaxChild = Syntax ( syntaxData)
1677
- assert ( syntaxChild. is ( ReturnClauseSyntax . self) )
1700
+ assert ( syntaxChild. is ( TokenSyntax . self) )
1678
1701
}
1679
- // Check child #4 child is TokenSyntax
1680
- assert ( rawChildren [ 4 ] . raw != nil )
1702
+ // Check child #4 child is ReturnClauseSyntax or missing
1681
1703
if let raw = rawChildren [ 4 ] . raw {
1682
1704
let info = rawChildren [ 4 ] . syntaxInfo
1683
1705
let absoluteRaw = AbsoluteRawSyntax ( raw: raw, info: info)
1684
1706
let syntaxData = SyntaxData ( absoluteRaw, parent: Syntax ( self ) )
1685
1707
let syntaxChild = Syntax ( syntaxData)
1708
+ assert ( syntaxChild. is ( ReturnClauseSyntax . self) )
1709
+ }
1710
+ // Check child #5 child is TokenSyntax
1711
+ assert ( rawChildren [ 5 ] . raw != nil )
1712
+ if let raw = rawChildren [ 5 ] . raw {
1713
+ let info = rawChildren [ 5 ] . syntaxInfo
1714
+ let absoluteRaw = AbsoluteRawSyntax ( raw: raw, info: info)
1715
+ let syntaxData = SyntaxData ( absoluteRaw, parent: Syntax ( self ) )
1716
+ let syntaxChild = Syntax ( syntaxData)
1686
1717
assert ( syntaxChild. is ( TokenSyntax . self) )
1687
1718
}
1688
1719
}
@@ -1693,6 +1724,7 @@ extension ClosureSignatureSyntax: CustomReflectable {
1693
1724
return Mirror ( self , children: [
1694
1725
" capture " : capture. map ( Syntax . init) ? . asProtocol ( SyntaxProtocol . self) as Any ,
1695
1726
" input " : input. map ( Syntax . init) ? . asProtocol ( SyntaxProtocol . self) as Any ,
1727
+ " asyncKeyword " : asyncKeyword. map ( Syntax . init) ? . asProtocol ( SyntaxProtocol . self) as Any ,
1696
1728
" throwsTok " : throwsTok. map ( Syntax . init) ? . asProtocol ( SyntaxProtocol . self) as Any ,
1697
1729
" output " : output. map ( Syntax . init) ? . asProtocol ( SyntaxProtocol . self) as Any ,
1698
1730
" inTok " : Syntax ( inTok) . asProtocol ( SyntaxProtocol . self) ,
0 commit comments