@@ -26,7 +26,7 @@ public protocol DeclSyntaxProtocol: SyntaxProtocol {}
26
26
/// These methods enable casting between syntax node types within the same
27
27
/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``).
28
28
///
29
- /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
29
+ /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
30
30
/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't
31
31
/// appropriate for use on types conforming to a specific base node protocol
32
32
/// like ``DeclSyntaxProtocol``. That's because at this level,
@@ -35,7 +35,7 @@ public protocol DeclSyntaxProtocol: SyntaxProtocol {}
35
35
///
36
36
/// To guide developers toward correct usage, this extension provides overloads
37
37
/// of these casting methods that are restricted to the same base node type.
38
- /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
38
+ /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
39
39
/// deprecated, indicating that they will always fail when used in this context.
40
40
extension DeclSyntaxProtocol {
41
41
/// Checks if the current syntax node can be cast to a given specialized syntax type.
@@ -184,9 +184,8 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
184
184
185
185
/// Create a ``DeclSyntax`` node from a specialized syntax node.
186
186
public init ( _ syntax: __shared some DeclSyntaxProtocol ) {
187
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
188
- // to do a sanity check and verify the kind matches in debug builds and get
189
- // maximum performance in release builds.
187
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
188
+ // verify the kind matches in debug builds and get maximum performance in release builds.
190
189
self = Syntax ( syntax) . cast ( Self . self)
191
190
}
192
191
@@ -199,9 +198,8 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
199
198
}
200
199
201
200
public init ( fromProtocol syntax: __shared DeclSyntaxProtocol) {
202
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
203
- // to do a sanity check and verify the kind matches in debug builds and get
204
- // maximum performance in release builds.
201
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
202
+ // verify the kind matches in debug builds and get maximum performance in release builds.
205
203
self = Syntax ( syntax) . cast ( Self . self)
206
204
}
207
205
@@ -327,7 +325,7 @@ public protocol ExprSyntaxProtocol: SyntaxProtocol {}
327
325
/// These methods enable casting between syntax node types within the same
328
326
/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``).
329
327
///
330
- /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
328
+ /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
331
329
/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't
332
330
/// appropriate for use on types conforming to a specific base node protocol
333
331
/// like ``ExprSyntaxProtocol``. That's because at this level,
@@ -336,7 +334,7 @@ public protocol ExprSyntaxProtocol: SyntaxProtocol {}
336
334
///
337
335
/// To guide developers toward correct usage, this extension provides overloads
338
336
/// of these casting methods that are restricted to the same base node type.
339
- /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
337
+ /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
340
338
/// deprecated, indicating that they will always fail when used in this context.
341
339
extension ExprSyntaxProtocol {
342
340
/// Checks if the current syntax node can be cast to a given specialized syntax type.
@@ -512,9 +510,8 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
512
510
513
511
/// Create a ``ExprSyntax`` node from a specialized syntax node.
514
512
public init ( _ syntax: __shared some ExprSyntaxProtocol ) {
515
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
516
- // to do a sanity check and verify the kind matches in debug builds and get
517
- // maximum performance in release builds.
513
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
514
+ // verify the kind matches in debug builds and get maximum performance in release builds.
518
515
self = Syntax ( syntax) . cast ( Self . self)
519
516
}
520
517
@@ -527,9 +524,8 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
527
524
}
528
525
529
526
public init ( fromProtocol syntax: __shared ExprSyntaxProtocol) {
530
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
531
- // to do a sanity check and verify the kind matches in debug builds and get
532
- // maximum performance in release builds.
527
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
528
+ // verify the kind matches in debug builds and get maximum performance in release builds.
533
529
self = Syntax ( syntax) . cast ( Self . self)
534
530
}
535
531
@@ -685,7 +681,7 @@ public protocol PatternSyntaxProtocol: SyntaxProtocol {}
685
681
/// These methods enable casting between syntax node types within the same
686
682
/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``).
687
683
///
688
- /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
684
+ /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
689
685
/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't
690
686
/// appropriate for use on types conforming to a specific base node protocol
691
687
/// like ``PatternSyntaxProtocol``. That's because at this level,
@@ -694,7 +690,7 @@ public protocol PatternSyntaxProtocol: SyntaxProtocol {}
694
690
///
695
691
/// To guide developers toward correct usage, this extension provides overloads
696
692
/// of these casting methods that are restricted to the same base node type.
697
- /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
693
+ /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
698
694
/// deprecated, indicating that they will always fail when used in this context.
699
695
extension PatternSyntaxProtocol {
700
696
/// Checks if the current syntax node can be cast to a given specialized syntax type.
@@ -826,9 +822,8 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable {
826
822
827
823
/// Create a ``PatternSyntax`` node from a specialized syntax node.
828
824
public init ( _ syntax: __shared some PatternSyntaxProtocol ) {
829
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
830
- // to do a sanity check and verify the kind matches in debug builds and get
831
- // maximum performance in release builds.
825
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
826
+ // verify the kind matches in debug builds and get maximum performance in release builds.
832
827
self = Syntax ( syntax) . cast ( Self . self)
833
828
}
834
829
@@ -841,9 +836,8 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable {
841
836
}
842
837
843
838
public init ( fromProtocol syntax: __shared PatternSyntaxProtocol) {
844
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
845
- // to do a sanity check and verify the kind matches in debug builds and get
846
- // maximum performance in release builds.
839
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
840
+ // verify the kind matches in debug builds and get maximum performance in release builds.
847
841
self = Syntax ( syntax) . cast ( Self . self)
848
842
}
849
843
@@ -952,7 +946,7 @@ public protocol StmtSyntaxProtocol: SyntaxProtocol {}
952
946
/// These methods enable casting between syntax node types within the same
953
947
/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``).
954
948
///
955
- /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
949
+ /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
956
950
/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't
957
951
/// appropriate for use on types conforming to a specific base node protocol
958
952
/// like ``StmtSyntaxProtocol``. That's because at this level,
@@ -961,7 +955,7 @@ public protocol StmtSyntaxProtocol: SyntaxProtocol {}
961
955
///
962
956
/// To guide developers toward correct usage, this extension provides overloads
963
957
/// of these casting methods that are restricted to the same base node type.
964
- /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
958
+ /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
965
959
/// deprecated, indicating that they will always fail when used in this context.
966
960
extension StmtSyntaxProtocol {
967
961
/// Checks if the current syntax node can be cast to a given specialized syntax type.
@@ -1102,9 +1096,8 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
1102
1096
1103
1097
/// Create a ``StmtSyntax`` node from a specialized syntax node.
1104
1098
public init ( _ syntax: __shared some StmtSyntaxProtocol ) {
1105
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
1106
- // to do a sanity check and verify the kind matches in debug builds and get
1107
- // maximum performance in release builds.
1099
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
1100
+ // verify the kind matches in debug builds and get maximum performance in release builds.
1108
1101
self = Syntax ( syntax) . cast ( Self . self)
1109
1102
}
1110
1103
@@ -1117,9 +1110,8 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
1117
1110
}
1118
1111
1119
1112
public init ( fromProtocol syntax: __shared StmtSyntaxProtocol) {
1120
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
1121
- // to do a sanity check and verify the kind matches in debug builds and get
1122
- // maximum performance in release builds.
1113
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
1114
+ // verify the kind matches in debug builds and get maximum performance in release builds.
1123
1115
self = Syntax ( syntax) . cast ( Self . self)
1124
1116
}
1125
1117
@@ -1238,7 +1230,7 @@ public protocol TypeSyntaxProtocol: SyntaxProtocol {}
1238
1230
/// These methods enable casting between syntax node types within the same
1239
1231
/// base node protocol hierarchy (e.g., ``DeclSyntaxProtocol``).
1240
1232
///
1241
- /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
1233
+ /// While ``SyntaxProtocol`` offers general casting methods (``SyntaxProtocol.as(_:)``,
1242
1234
/// ``SyntaxProtocol.is(_:)``, and ``SyntaxProtocol.cast(_:)``), these often aren't
1243
1235
/// appropriate for use on types conforming to a specific base node protocol
1244
1236
/// like ``TypeSyntaxProtocol``. That's because at this level,
@@ -1247,7 +1239,7 @@ public protocol TypeSyntaxProtocol: SyntaxProtocol {}
1247
1239
///
1248
1240
/// To guide developers toward correct usage, this extension provides overloads
1249
1241
/// of these casting methods that are restricted to the same base node type.
1250
- /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
1242
+ /// Furthermore, it marks the inherited casting methods from ``SyntaxProtocol`` as
1251
1243
/// deprecated, indicating that they will always fail when used in this context.
1252
1244
extension TypeSyntaxProtocol {
1253
1245
/// Checks if the current syntax node can be cast to a given specialized syntax type.
@@ -1390,9 +1382,8 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
1390
1382
1391
1383
/// Create a ``TypeSyntax`` node from a specialized syntax node.
1392
1384
public init ( _ syntax: __shared some TypeSyntaxProtocol ) {
1393
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
1394
- // to do a sanity check and verify the kind matches in debug builds and get
1395
- // maximum performance in release builds.
1385
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
1386
+ // verify the kind matches in debug builds and get maximum performance in release builds.
1396
1387
self = Syntax ( syntax) . cast ( Self . self)
1397
1388
}
1398
1389
@@ -1405,9 +1396,8 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
1405
1396
}
1406
1397
1407
1398
public init ( fromProtocol syntax: __shared TypeSyntaxProtocol) {
1408
- // We know this cast is going to succeed. Go through init(_: SyntaxData)
1409
- // to do a sanity check and verify the kind matches in debug builds and get
1410
- // maximum performance in release builds.
1399
+ // We know this cast is going to succeed. Go through `init(_: SyntaxData)` just to double-check and
1400
+ // verify the kind matches in debug builds and get maximum performance in release builds.
1411
1401
self = Syntax ( syntax) . cast ( Self . self)
1412
1402
}
1413
1403
0 commit comments