@@ -3415,6 +3415,7 @@ public struct DoExprSyntax: ExprSyntaxProtocol, SyntaxHashable, _LeafExprSyntaxN
3415
3415
/// ### Children
3416
3416
///
3417
3417
/// - `doKeyword`: `do`
3418
+ /// - `throwsClause`: ``ThrowsClauseSyntax``?
3418
3419
/// - `body`: ``CodeBlockSyntax``
3419
3420
/// - `catchClauses`: ``CatchClauseListSyntax``
3420
3421
public struct DoStmtSyntax : StmtSyntaxProtocol , SyntaxHashable , _LeafStmtSyntaxNodeProtocol {
@@ -3429,12 +3430,15 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3429
3430
3430
3431
/// - Parameters:
3431
3432
/// - leadingTrivia: Trivia to be prepended to the leading trivia of the node’s first token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
3433
+ /// - throwsClause: The clause specifying the type of errors thrown from the 'do' block.
3432
3434
/// - trailingTrivia: Trivia to be appended to the trailing trivia of the node’s last token. If the node is empty, there is no token to attach the trivia to and the parameter is ignored.
3433
3435
public init (
3434
3436
leadingTrivia: Trivia ? = nil ,
3435
3437
_ unexpectedBeforeDoKeyword: UnexpectedNodesSyntax ? = nil ,
3436
3438
doKeyword: TokenSyntax = . keyword( . do) ,
3437
- _ unexpectedBetweenDoKeywordAndBody: UnexpectedNodesSyntax ? = nil ,
3439
+ _ unexpectedBetweenDoKeywordAndThrowsClause: UnexpectedNodesSyntax ? = nil ,
3440
+ throwsClause: ThrowsClauseSyntax ? = nil ,
3441
+ _ unexpectedBetweenThrowsClauseAndBody: UnexpectedNodesSyntax ? = nil ,
3438
3442
body: CodeBlockSyntax ,
3439
3443
_ unexpectedBetweenBodyAndCatchClauses: UnexpectedNodesSyntax ? = nil ,
3440
3444
catchClauses: CatchClauseListSyntax = [ ] ,
@@ -3447,7 +3451,9 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3447
3451
self = withExtendedLifetime ( ( SyntaxArena ( ) , (
3448
3452
unexpectedBeforeDoKeyword,
3449
3453
doKeyword,
3450
- unexpectedBetweenDoKeywordAndBody,
3454
+ unexpectedBetweenDoKeywordAndThrowsClause,
3455
+ throwsClause,
3456
+ unexpectedBetweenThrowsClauseAndBody,
3451
3457
body,
3452
3458
unexpectedBetweenBodyAndCatchClauses,
3453
3459
catchClauses,
@@ -3456,7 +3462,9 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3456
3462
let layout : [ RawSyntax ? ] = [
3457
3463
unexpectedBeforeDoKeyword? . raw,
3458
3464
doKeyword. raw,
3459
- unexpectedBetweenDoKeywordAndBody? . raw,
3465
+ unexpectedBetweenDoKeywordAndThrowsClause? . raw,
3466
+ throwsClause? . raw,
3467
+ unexpectedBetweenThrowsClauseAndBody? . raw,
3460
3468
body. raw,
3461
3469
unexpectedBetweenBodyAndCatchClauses? . raw,
3462
3470
catchClauses. raw,
@@ -3495,7 +3503,7 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3495
3503
}
3496
3504
}
3497
3505
3498
- public var unexpectedBetweenDoKeywordAndBody : UnexpectedNodesSyntax ? {
3506
+ public var unexpectedBetweenDoKeywordAndThrowsClause : UnexpectedNodesSyntax ? {
3499
3507
get {
3500
3508
return Syntax ( self ) . child ( at: 2 ) ? . cast ( UnexpectedNodesSyntax . self)
3501
3509
}
@@ -3504,16 +3512,18 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3504
3512
}
3505
3513
}
3506
3514
3507
- public var body : CodeBlockSyntax {
3515
+ /// The clause specifying the type of errors thrown from the 'do' block.
3516
+ @_spi ( ExperimentalLanguageFeatures)
3517
+ public var throwsClause : ThrowsClauseSyntax ? {
3508
3518
get {
3509
- return Syntax ( self ) . child ( at: 3 ) ! . cast ( CodeBlockSyntax . self)
3519
+ return Syntax ( self ) . child ( at: 3 ) ? . cast ( ThrowsClauseSyntax . self)
3510
3520
}
3511
3521
set ( value) {
3512
3522
self = Syntax ( self ) . replacingChild ( at: 3 , with: Syntax ( value) , arena: SyntaxArena ( ) ) . cast ( DoStmtSyntax . self)
3513
3523
}
3514
3524
}
3515
3525
3516
- public var unexpectedBetweenBodyAndCatchClauses : UnexpectedNodesSyntax ? {
3526
+ public var unexpectedBetweenThrowsClauseAndBody : UnexpectedNodesSyntax ? {
3517
3527
get {
3518
3528
return Syntax ( self ) . child ( at: 4 ) ? . cast ( UnexpectedNodesSyntax . self)
3519
3529
}
@@ -3522,15 +3532,33 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3522
3532
}
3523
3533
}
3524
3534
3525
- public var catchClauses : CatchClauseListSyntax {
3535
+ public var body : CodeBlockSyntax {
3526
3536
get {
3527
- return Syntax ( self ) . child ( at: 5 ) !. cast ( CatchClauseListSyntax . self)
3537
+ return Syntax ( self ) . child ( at: 5 ) !. cast ( CodeBlockSyntax . self)
3528
3538
}
3529
3539
set ( value) {
3530
3540
self = Syntax ( self ) . replacingChild ( at: 5 , with: Syntax ( value) , arena: SyntaxArena ( ) ) . cast ( DoStmtSyntax . self)
3531
3541
}
3532
3542
}
3533
3543
3544
+ public var unexpectedBetweenBodyAndCatchClauses : UnexpectedNodesSyntax ? {
3545
+ get {
3546
+ return Syntax ( self ) . child ( at: 6 ) ? . cast ( UnexpectedNodesSyntax . self)
3547
+ }
3548
+ set ( value) {
3549
+ self = Syntax ( self ) . replacingChild ( at: 6 , with: Syntax ( value) , arena: SyntaxArena ( ) ) . cast ( DoStmtSyntax . self)
3550
+ }
3551
+ }
3552
+
3553
+ public var catchClauses : CatchClauseListSyntax {
3554
+ get {
3555
+ return Syntax ( self ) . child ( at: 7 ) !. cast ( CatchClauseListSyntax . self)
3556
+ }
3557
+ set ( value) {
3558
+ self = Syntax ( self ) . replacingChild ( at: 7 , with: Syntax ( value) , arena: SyntaxArena ( ) ) . cast ( DoStmtSyntax . self)
3559
+ }
3560
+ }
3561
+
3534
3562
/// Adds the provided `element` to the node's `catchClauses`
3535
3563
/// collection.
3536
3564
///
@@ -3542,15 +3570,15 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3542
3570
public func addCatchClause( _ element: CatchClauseSyntax ) -> DoStmtSyntax {
3543
3571
var collection : RawSyntax
3544
3572
let arena = SyntaxArena ( )
3545
- if let col = raw. layoutView!. children [ 5 ] {
3573
+ if let col = raw. layoutView!. children [ 7 ] {
3546
3574
collection = col. layoutView!. appending ( element. raw, arena: arena)
3547
3575
} else {
3548
3576
collection = RawSyntax . makeLayout ( kind: SyntaxKind . catchClauseList,
3549
3577
from: [ element. raw] , arena: arena)
3550
3578
}
3551
3579
return Syntax ( self )
3552
3580
. replacingChild (
3553
- at: 5 ,
3581
+ at: 7 ,
3554
3582
with: collection,
3555
3583
rawNodeArena: arena,
3556
3584
allocationArena: arena
@@ -3560,18 +3588,20 @@ public struct DoStmtSyntax: StmtSyntaxProtocol, SyntaxHashable, _LeafStmtSyntaxN
3560
3588
3561
3589
public var unexpectedAfterCatchClauses : UnexpectedNodesSyntax ? {
3562
3590
get {
3563
- return Syntax ( self ) . child ( at: 6 ) ? . cast ( UnexpectedNodesSyntax . self)
3591
+ return Syntax ( self ) . child ( at: 8 ) ? . cast ( UnexpectedNodesSyntax . self)
3564
3592
}
3565
3593
set ( value) {
3566
- self = Syntax ( self ) . replacingChild ( at: 6 , with: Syntax ( value) , arena: SyntaxArena ( ) ) . cast ( DoStmtSyntax . self)
3594
+ self = Syntax ( self ) . replacingChild ( at: 8 , with: Syntax ( value) , arena: SyntaxArena ( ) ) . cast ( DoStmtSyntax . self)
3567
3595
}
3568
3596
}
3569
3597
3570
3598
public static var structure : SyntaxNodeStructure {
3571
3599
return . layout( [
3572
3600
\Self . unexpectedBeforeDoKeyword,
3573
3601
\Self . doKeyword,
3574
- \Self . unexpectedBetweenDoKeywordAndBody,
3602
+ \Self . unexpectedBetweenDoKeywordAndThrowsClause,
3603
+ \Self . throwsClause,
3604
+ \Self . unexpectedBetweenThrowsClauseAndBody,
3575
3605
\Self . body,
3576
3606
\Self . unexpectedBetweenBodyAndCatchClauses,
3577
3607
\Self . catchClauses,
0 commit comments