1717/// Note that this only validates the immediate children.
1818/// Results in an assertion failure if the layout is invalid.
1919func validateLayout( layout: RawSyntaxBuffer , as kind: SyntaxKind ) {
20- #if DEBUG
20+ #if SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION
2121 enum TokenChoice : CustomStringConvertible {
2222 case keyword( StaticString )
2323 case tokenKind( RawTokenKind )
@@ -140,7 +140,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
140140 // the list of expected token choices in the syntax tree doesn't match those
141141 // the parser generates. Disable the verification for now until all issues
142142 // regarding it are fixed.
143- #if VALIDATE_TOKEN_CHOICES
144143 if raw != nil {
145144 return verify (
146145 raw,
@@ -151,9 +150,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
151150 )
152151 }
153152 return nil
154- #else
155- return verify ( raw, as: RawTokenSyntax ? . self)
156- #endif
157153 }
158154 func verify(
159155 _ raw: RawSyntax ? ,
@@ -166,7 +162,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
166162 // the list of expected token choices in the syntax tree doesn't match those
167163 // the parser generates. Disable the verification for now until all issues
168164 // regarding it are fixed.
169- #if VALIDATE_TOKEN_CHOICES
170165 guard let raw = raw else {
171166 return . expectedNonNil( expectedKind: RawTokenSyntax . self, file: file, line: line)
172167 }
@@ -193,9 +188,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
193188 file: file,
194189 line: line
195190 )
196- #else
197- return verify ( raw, as: RawTokenSyntax . self)
198- #endif
199191 }
200192 func assertNoError( _ nodeKind: SyntaxKind , _ index: Int , _ error: ValidationError ? ) {
201193 if let error = error {
0 commit comments