@@ -82,14 +82,12 @@ public struct DeclSyntax: DeclSyntaxProtocol, SyntaxHashable {
8282 /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
8383 /// is undefined.
8484 internal init ( _ data: SyntaxData ) {
85- #if DEBUG
8685 switch data. raw. kind {
8786 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:
8887 break
8988 default :
90- fatalError ( " Unable to create DeclSyntax from \( data. raw. kind) " )
89+ preconditionFailure ( " Unable to create DeclSyntax from \( data. raw. kind) " )
9190 }
92- #endif
9391 self . _syntaxNode = Syntax ( data)
9492 }
9593
@@ -219,14 +217,12 @@ public struct ExprSyntax: ExprSyntaxProtocol, SyntaxHashable {
219217 /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
220218 /// is undefined.
221219 internal init ( _ data: SyntaxData ) {
222- #if DEBUG
223220 switch data. raw. kind {
224221 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:
225222 break
226223 default :
227- fatalError ( " Unable to create ExprSyntax from \( data. raw. kind) " )
224+ preconditionFailure ( " Unable to create ExprSyntax from \( data. raw. kind) " )
228225 }
229- #endif
230226 self . _syntaxNode = Syntax ( data)
231227 }
232228
@@ -380,14 +376,12 @@ public struct PatternSyntax: PatternSyntaxProtocol, SyntaxHashable {
380376 /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
381377 /// is undefined.
382378 internal init ( _ data: SyntaxData ) {
383- #if DEBUG
384379 switch data. raw. kind {
385380 case . expressionPattern, . identifierPattern, . isTypePattern, . missingPattern, . tuplePattern, . valueBindingPattern, . wildcardPattern:
386381 break
387382 default :
388- fatalError ( " Unable to create PatternSyntax from \( data. raw. kind) " )
383+ preconditionFailure ( " Unable to create PatternSyntax from \( data. raw. kind) " )
389384 }
390- #endif
391385 self . _syntaxNode = Syntax ( data)
392386 }
393387
@@ -500,14 +494,12 @@ public struct StmtSyntax: StmtSyntaxProtocol, SyntaxHashable {
500494 /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
501495 /// is undefined.
502496 internal init ( _ data: SyntaxData ) {
503- #if DEBUG
504497 switch data. raw. kind {
505498 case . breakStmt, . continueStmt, . deferStmt, . doStmt, . expressionStmt, . fallthroughStmt, . forInStmt, . forgetStmt, . guardStmt, . labeledStmt, . missingStmt, . repeatWhileStmt, . returnStmt, . throwStmt, . whileStmt, . yieldStmt:
506499 break
507500 default :
508- fatalError ( " Unable to create StmtSyntax from \( data. raw. kind) " )
501+ preconditionFailure ( " Unable to create StmtSyntax from \( data. raw. kind) " )
509502 }
510- #endif
511503 self . _syntaxNode = Syntax ( data)
512504 }
513505
@@ -629,14 +621,12 @@ public struct TypeSyntax: TypeSyntaxProtocol, SyntaxHashable {
629621 /// that the `SyntaxData` is of the correct kind. If it is not, the behaviour
630622 /// is undefined.
631623 internal init ( _ data: SyntaxData ) {
632- #if DEBUG
633624 switch data. raw. kind {
634625 case . arrayType, . attributedType, . classRestrictionType, . compositionType, . constrainedSugarType, . dictionaryType, . functionType, . implicitlyUnwrappedOptionalType, . memberTypeIdentifier, . metatypeType, . missingType, . namedOpaqueReturnType, . optionalType, . packExpansionType, . packReferenceType, . simpleTypeIdentifier, . tupleType:
635626 break
636627 default :
637- fatalError ( " Unable to create TypeSyntax from \( data. raw. kind) " )
628+ preconditionFailure ( " Unable to create TypeSyntax from \( data. raw. kind) " )
638629 }
639- #endif
640630 self . _syntaxNode = Syntax ( data)
641631 }
642632
0 commit comments