17
17
/// Note that this only validates the immediate children.
18
18
/// Results in an assertion failure if the layout is invalid.
19
19
func validateLayout( layout: RawSyntaxBuffer , as kind: SyntaxKind ) {
20
- #if DEBUG
20
+ #if SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION
21
21
enum TokenChoice : CustomStringConvertible {
22
22
case keyword( StaticString )
23
23
case tokenKind( RawTokenKind )
@@ -140,7 +140,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
140
140
// the list of expected token choices in the syntax tree doesn't match those
141
141
// the parser generates. Disable the verification for now until all issues
142
142
// regarding it are fixed.
143
- #if VALIDATE_TOKEN_CHOICES
144
143
if raw != nil {
145
144
return verify (
146
145
raw,
@@ -151,9 +150,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
151
150
)
152
151
}
153
152
return nil
154
- #else
155
- return verify ( raw, as: RawTokenSyntax ? . self)
156
- #endif
157
153
}
158
154
func verify(
159
155
_ raw: RawSyntax ? ,
@@ -166,7 +162,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
166
162
// the list of expected token choices in the syntax tree doesn't match those
167
163
// the parser generates. Disable the verification for now until all issues
168
164
// regarding it are fixed.
169
- #if VALIDATE_TOKEN_CHOICES
170
165
guard let raw = raw else {
171
166
return . expectedNonNil( expectedKind: RawTokenSyntax . self, file: file, line: line)
172
167
}
@@ -193,9 +188,6 @@ func validateLayout(layout: RawSyntaxBuffer, as kind: SyntaxKind) {
193
188
file: file,
194
189
line: line
195
190
)
196
- #else
197
- return verify ( raw, as: RawTokenSyntax . self)
198
- #endif
199
191
}
200
192
func assertNoError( _ nodeKind: SyntaxKind , _ index: Int , _ error: ValidationError ? ) {
201
193
if let error = error {
0 commit comments