Skip to content

Commit 7d9a12e

Browse files
authored
Merge pull request #1537 from ahoppen/ahoppen/rawsyntaxtoken-validation
Update RawSyntaxValidationFile.swift
2 parents e92c961 + 7a776d2 commit 7d9a12e

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

CodeGeneration/Sources/generate-swiftsyntax/templates/swiftsyntax/RawSyntaxValidationFile.swift

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead
2929
clauses: try IfConfigClauseListSyntax {
3030
IfConfigClauseSyntax(
3131
poundKeyword: .poundIfKeyword(),
32-
condition: ExprSyntax("DEBUG"),
32+
condition: ExprSyntax("SWIFTSYNTAX_ENABLE_RAWSYNTAX_VALIDATION"),
3333
elements: .statements(
3434
try CodeBlockItemListSyntax {
3535
DeclSyntax(
@@ -114,14 +114,10 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead
114114
// the list of expected token choices in the syntax tree doesn't match those
115115
// the parser generates. Disable the verification for now until all issues
116116
// regarding it are fixed.
117-
#if VALIDATE_TOKEN_CHOICES
118117
if raw != nil {
119118
return verify(raw, as: RawTokenSyntax.self, tokenChoices: tokenChoices, file: file, line: line)
120119
}
121120
return nil
122-
#else
123-
return verify(raw, as: RawTokenSyntax?.self)
124-
#endif
125121
}
126122
"""
127123
)
@@ -133,7 +129,6 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead
133129
// the list of expected token choices in the syntax tree doesn't match those
134130
// the parser generates. Disable the verification for now until all issues
135131
// regarding it are fixed.
136-
#if VALIDATE_TOKEN_CHOICES
137132
guard let raw = raw else {
138133
return .expectedNonNil(expectedKind: RawTokenSyntax.self, file: file, line: line)
139134
}
@@ -154,9 +149,6 @@ let rawSyntaxValidationFile = try! SourceFileSyntax(leadingTrivia: copyrightHead
154149
}
155150
}
156151
return ValidationError.tokenMismatch(expectedTokenChoices: tokenChoices, actualKind: tokenView.rawKind, actualText: tokenView.rawText, file: file, line: line)
157-
#else
158-
return verify(raw, as: RawTokenSyntax.self)
159-
#endif
160152
}
161153
162154
"""

0 commit comments

Comments
 (0)