@@ -78,13 +78,6 @@ public extension BridgedSourceLoc {
78
78
}
79
79
}
80
80
81
- extension BridgedSourceRange {
82
- @inline ( __always)
83
- init ( startToken: TokenSyntax , endToken: TokenSyntax , in astgen: ASTGenVisitor ) {
84
- self . init ( start: startToken. bridgedSourceLoc ( in: astgen) , end: endToken. bridgedSourceLoc ( in: astgen) )
85
- }
86
- }
87
-
88
81
extension String {
89
82
init ( bridged: BridgedStringRef ) {
90
83
self . init (
@@ -141,81 +134,80 @@ extension SyntaxProtocol {
141
134
/// Obtains the bridged start location of the node excluding leading trivia in the source buffer provided by `astgen`
142
135
///
143
136
/// - Parameter astgen: The visitor providing the source buffer.
137
+ @available ( * , deprecated, message: " use ASTContext.bridgedSourceLoc(syntax:) " )
144
138
@inline ( __always)
145
139
func bridgedSourceLoc( in astgen: ASTGenVisitor ) -> BridgedSourceLoc {
146
- return BridgedSourceLoc ( at : self . positionAfterSkippingLeadingTrivia , in : astgen. base )
140
+ astgen. generateSourceLoc ( self )
147
141
}
148
142
}
149
143
150
144
extension Optional where Wrapped: SyntaxProtocol {
151
145
/// Obtains the bridged start location of the node excluding leading trivia in the source buffer provided by `astgen`.
152
146
///
153
147
/// - Parameter astgen: The visitor providing the source buffer.
148
+ @available ( * , deprecated, message: " use ASTContext.bridgedSourceLoc(syntax:) " )
154
149
@inline ( __always)
155
150
func bridgedSourceLoc( in astgen: ASTGenVisitor ) -> BridgedSourceLoc {
156
- guard let self else {
157
- return nil
158
- }
159
-
160
- return self . bridgedSourceLoc ( in: astgen)
151
+ astgen. generateSourceLoc ( self )
161
152
}
162
153
}
163
154
164
155
extension TokenSyntax {
165
156
/// Obtains a bridged, `ASTContext`-owned copy of this token's text.
166
157
///
167
158
/// - Parameter astgen: The visitor providing the `ASTContext`.
159
+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifier(token:) " )
168
160
@inline ( __always)
169
161
func bridgedIdentifier( in astgen: ASTGenVisitor ) -> BridgedIdentifier {
170
- var text = self . text
171
- return text. withBridgedString { bridged in
172
- astgen. ctx. getIdentifier ( bridged)
173
- }
162
+ astgen. generateIdentifier ( self )
174
163
}
175
164
176
165
/// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
177
166
/// source buffer provided by `astgen`.
178
167
///
179
168
/// - Parameter astgen: The visitor providing the `ASTContext` and source buffer.
169
+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifierAndSourceLoc(token:) " )
180
170
@inline ( __always)
181
171
func bridgedIdentifierAndSourceLoc( in astgen: ASTGenVisitor ) -> ( BridgedIdentifier , BridgedSourceLoc ) {
182
- return ( self . bridgedIdentifier ( in : astgen) , self . bridgedSourceLoc ( in : astgen ) )
172
+ astgen. generateIdentifierAndSourceLoc ( self )
183
173
}
184
174
185
175
/// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
186
176
/// source buffer provided by `astgen`.
187
177
///
188
178
/// - Parameter astgen: The visitor providing the `ASTContext` and source buffer.
179
+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifierAndSourceLoc(token:) " )
189
180
@inline ( __always)
190
- func bridgedIdentifierAndSourceLoc( in astgen: ASTGenVisitor ) -> BridgedIdentifierAndSourceLoc {
191
- let ( name, nameLoc) = self . bridgedIdentifierAndSourceLoc ( in: astgen)
192
- return . init( name: name, nameLoc: nameLoc)
181
+ func bridgedIdentifierAndSourceLoc( in astgen: ASTGenVisitor ) -> BridgedLocatedIdentifier {
182
+ astgen. generateLocatedIdentifier ( self )
193
183
}
194
184
}
195
185
196
186
extension Optional < TokenSyntax > {
197
187
/// Obtains a bridged, `ASTContext`-owned copy of this token's text.
198
188
///
199
189
/// - Parameter astgen: The visitor providing the `ASTContext`.
190
+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifier(token:) " )
200
191
@inline ( __always)
201
192
func bridgedIdentifier( in astgen: ASTGenVisitor ) -> BridgedIdentifier {
202
- guard let self else {
203
- return nil
204
- }
205
-
206
- return self . bridgedIdentifier ( in: astgen)
193
+ astgen. generateIdentifier ( self )
207
194
}
208
195
209
196
/// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
210
197
/// source buffer provided by `astgen` excluding leading trivia.
211
198
///
212
199
/// - Parameter astgen: The visitor providing the `ASTContext` and source buffer.
200
+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifierAndSourceLoc(token:) " )
213
201
@inline ( __always)
214
202
func bridgedIdentifierAndSourceLoc( in astgen: ASTGenVisitor ) -> ( BridgedIdentifier , BridgedSourceLoc ) {
215
- guard let self else {
216
- return ( nil , nil )
217
- }
203
+ astgen . generateIdentifierAndSourceLoc ( self )
204
+ }
205
+ }
218
206
219
- return self . bridgedIdentifierAndSourceLoc ( in: astgen)
207
+ extension BridgedSourceRange {
208
+ @available ( * , deprecated, message: " use ASTContext.bridgedSourceRange(startToken:endToken:) " )
209
+ @inline ( __always)
210
+ init ( startToken: TokenSyntax , endToken: TokenSyntax , in astgen: ASTGenVisitor ) {
211
+ self = astgen. generateSourceRange ( start: startToken, end: endToken)
220
212
}
221
213
}
0 commit comments