@@ -82,14 +82,12 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
82
82
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
83
83
/// is undefined.
84
84
internal init ( _ data: SyntaxData ) {
85
- #if DEBUG
86
85
switch data. raw. kind {
87
86
case . accessorDecl, . actorDecl, . associatedtypeDecl, . classDecl, . deinitializerDecl, . editorPlaceholderDecl, . enumCaseDecl, . enumDecl, . extensionDecl, . functionDecl, . ifConfigDecl, . importDecl, . initializerDecl, . macroDecl, . macroExpansionDecl, . missingDecl, . operatorDecl, . poundSourceLocation, . precedenceGroupDecl, . protocolDecl, . structDecl, . subscriptDecl, . typealiasDecl, . variableDecl:
88
87
break
89
88
default :
90
- fatalError ( " Unable to create DeclSyntax from \( data. raw. kind) " )
89
+ preconditionFailure ( " Unable to create DeclSyntax from \( data. raw. kind) " )
91
90
}
92
- #endif
93
91
self . _syntaxNode = Syntax ( data)
94
92
}
95
93
@@ -227,14 +225,12 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
227
225
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
228
226
/// is undefined.
229
227
internal init ( _ data: SyntaxData ) {
230
- #if DEBUG
231
228
switch data. raw. kind {
232
229
case . arrayExpr, . arrowExpr, . asExpr, . assignmentExpr, . awaitExpr, . binaryOperatorExpr, . booleanLiteralExpr, . borrowExpr, . closureExpr, . dictionaryExpr, . discardAssignmentExpr, . editorPlaceholderExpr, . floatLiteralExpr, . forcedValueExpr, . functionCallExpr, . identifierExpr, . ifExpr, . inOutExpr, . infixOperatorExpr, . integerLiteralExpr, . isExpr, . keyPathExpr, . macroExpansionExpr, . memberAccessExpr, . missingExpr, . moveExpr, . nilLiteralExpr, . optionalChainingExpr, . packElementExpr, . packExpansionExpr, . postfixIfConfigExpr, . postfixUnaryExpr, . prefixOperatorExpr, . regexLiteralExpr, . sequenceExpr, . specializeExpr, . stringLiteralExpr, . subscriptExpr, . superRefExpr, . switchExpr, . ternaryExpr, . tryExpr, . tupleExpr, . typeExpr, . unresolvedAsExpr, . unresolvedIsExpr, . unresolvedPatternExpr, . unresolvedTernaryExpr:
233
230
break
234
231
default :
235
- fatalError ( " Unable to create ExprSyntax from \( data. raw. kind) " )
232
+ preconditionFailure ( " Unable to create ExprSyntax from \( data. raw. kind) " )
236
233
}
237
- #endif
238
234
self . _syntaxNode = Syntax ( data)
239
235
}
240
236
@@ -396,14 +392,12 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable {
396
392
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
397
393
/// is undefined.
398
394
internal init ( _ data: SyntaxData ) {
399
- #if DEBUG
400
395
switch data. raw. kind {
401
396
case . expressionPattern, . identifierPattern, . isTypePattern, . missingPattern, . tuplePattern, . valueBindingPattern, . wildcardPattern:
402
397
break
403
398
default :
404
- fatalError ( " Unable to create PatternSyntax from \( data. raw. kind) " )
399
+ preconditionFailure ( " Unable to create PatternSyntax from \( data. raw. kind) " )
405
400
}
406
- #endif
407
401
self . _syntaxNode = Syntax ( data)
408
402
}
409
403
@@ -524,14 +518,12 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
524
518
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
525
519
/// is undefined.
526
520
internal init ( _ data: SyntaxData ) {
527
- #if DEBUG
528
521
switch data. raw. kind {
529
522
case . breakStmt, . continueStmt, . deferStmt, . doStmt, . expressionStmt, . fallthroughStmt, . forInStmt, . forgetStmt, . guardStmt, . labeledStmt, . missingStmt, . repeatWhileStmt, . returnStmt, . throwStmt, . whileStmt, . yieldStmt:
530
523
break
531
524
default :
532
- fatalError ( " Unable to create StmtSyntax from \( data. raw. kind) " )
525
+ preconditionFailure ( " Unable to create StmtSyntax from \( data. raw. kind) " )
533
526
}
534
- #endif
535
527
self . _syntaxNode = Syntax ( data)
536
528
}
537
529
@@ -661,14 +653,12 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
661
653
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
662
654
/// is undefined.
663
655
internal init ( _ data: SyntaxData ) {
664
- #if DEBUG
665
656
switch data. raw. kind {
666
657
case . arrayType, . attributedType, . classRestrictionType, . compositionType, . constrainedSugarType, . dictionaryType, . functionType, . implicitlyUnwrappedOptionalType, . memberTypeIdentifier, . metatypeType, . missingType, . namedOpaqueReturnType, . optionalType, . packExpansionType, . packReferenceType, . simpleTypeIdentifier, . tupleType:
667
658
break
668
659
default :
669
- fatalError ( " Unable to create TypeSyntax from \( data. raw. kind) " )
660
+ preconditionFailure ( " Unable to create TypeSyntax from \( data. raw. kind) " )
670
661
}
671
- #endif
672
662
self . _syntaxNode = Syntax ( data)
673
663
}
674
664
0 commit comments