@@ -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
@@ -219,14 +217,12 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
219
217
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
220
218
/// is undefined.
221
219
internal init ( _ data: SyntaxData ) {
222
- #if DEBUG
223
220
switch data. raw. kind {
224
221
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:
225
222
break
226
223
default :
227
- fatalError ( " Unable to create ExprSyntax from \( data. raw. kind) " )
224
+ preconditionFailure ( " Unable to create ExprSyntax from \( data. raw. kind) " )
228
225
}
229
- #endif
230
226
self . _syntaxNode = Syntax ( data)
231
227
}
232
228
@@ -380,14 +376,12 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable {
380
376
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
381
377
/// is undefined.
382
378
internal init ( _ data: SyntaxData ) {
383
- #if DEBUG
384
379
switch data. raw. kind {
385
380
case . expressionPattern, . identifierPattern, . isTypePattern, . missingPattern, . tuplePattern, . valueBindingPattern, . wildcardPattern:
386
381
break
387
382
default :
388
- fatalError ( " Unable to create PatternSyntax from \( data. raw. kind) " )
383
+ preconditionFailure ( " Unable to create PatternSyntax from \( data. raw. kind) " )
389
384
}
390
- #endif
391
385
self . _syntaxNode = Syntax ( data)
392
386
}
393
387
@@ -500,14 +494,12 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
500
494
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
501
495
/// is undefined.
502
496
internal init ( _ data: SyntaxData ) {
503
- #if DEBUG
504
497
switch data. raw. kind {
505
498
case . breakStmt, . continueStmt, . deferStmt, . doStmt, . expressionStmt, . fallthroughStmt, . forInStmt, . forgetStmt, . guardStmt, . labeledStmt, . missingStmt, . repeatWhileStmt, . returnStmt, . throwStmt, . whileStmt, . yieldStmt:
506
499
break
507
500
default :
508
- fatalError ( " Unable to create StmtSyntax from \( data. raw. kind) " )
501
+ preconditionFailure ( " Unable to create StmtSyntax from \( data. raw. kind) " )
509
502
}
510
- #endif
511
503
self . _syntaxNode = Syntax ( data)
512
504
}
513
505
@@ -629,14 +621,12 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
629
621
/// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
630
622
/// is undefined.
631
623
internal init ( _ data: SyntaxData ) {
632
- #if DEBUG
633
624
switch data. raw. kind {
634
625
case . arrayType, . attributedType, . classRestrictionType, . compositionType, . constrainedSugarType, . dictionaryType, . functionType, . implicitlyUnwrappedOptionalType, . memberTypeIdentifier, . metatypeType, . missingType, . namedOpaqueReturnType, . optionalType, . packExpansionType, . packReferenceType, . simpleTypeIdentifier, . tupleType:
635
626
break
636
627
default :
637
- fatalError ( " Unable to create TypeSyntax from \( data. raw. kind) " )
628
+ preconditionFailure ( " Unable to create TypeSyntax from \( data. raw. kind) " )
638
629
}
639
- #endif
640
630
self . _syntaxNode = Syntax ( data)
641
631
}
642
632
0 commit comments