@@ -78,13 +78,6 @@ public extension BridgedSourceLoc {
7878 }
7979}
8080
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-
8881extension String {
8982 init ( bridged: BridgedStringRef ) {
9083 self . init (
@@ -141,81 +134,80 @@ extension SyntaxProtocol {
141134 /// Obtains the bridged start location of the node excluding leading trivia in the source buffer provided by `astgen`
142135 ///
143136 /// - Parameter astgen: The visitor providing the source buffer.
137+ @available ( * , deprecated, message: " use ASTContext.bridgedSourceLoc(syntax:) " )
144138 @inline ( __always)
145139 func bridgedSourceLoc( in astgen: ASTGenVisitor ) -> BridgedSourceLoc {
146- return BridgedSourceLoc ( at : self . positionAfterSkippingLeadingTrivia , in : astgen. base )
140+ astgen. generateSourceLoc ( self )
147141 }
148142}
149143
150144extension Optional where Wrapped: SyntaxProtocol {
151145 /// Obtains the bridged start location of the node excluding leading trivia in the source buffer provided by `astgen`.
152146 ///
153147 /// - Parameter astgen: The visitor providing the source buffer.
148+ @available ( * , deprecated, message: " use ASTContext.bridgedSourceLoc(syntax:) " )
154149 @inline ( __always)
155150 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 )
161152 }
162153}
163154
164155extension TokenSyntax {
165156 /// Obtains a bridged, `ASTContext`-owned copy of this token's text.
166157 ///
167158 /// - Parameter astgen: The visitor providing the `ASTContext`.
159+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifier(token:) " )
168160 @inline ( __always)
169161 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 )
174163 }
175164
176165 /// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
177166 /// source buffer provided by `astgen`.
178167 ///
179168 /// - Parameter astgen: The visitor providing the `ASTContext` and source buffer.
169+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifierAndSourceLoc(token:) " )
180170 @inline ( __always)
181171 func bridgedIdentifierAndSourceLoc( in astgen: ASTGenVisitor ) -> ( BridgedIdentifier , BridgedSourceLoc ) {
182- return ( self . bridgedIdentifier ( in : astgen) , self . bridgedSourceLoc ( in : astgen ) )
172+ astgen. generateIdentifierAndSourceLoc ( self )
183173 }
184174
185175 /// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
186176 /// source buffer provided by `astgen`.
187177 ///
188178 /// - Parameter astgen: The visitor providing the `ASTContext` and source buffer.
179+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifierAndSourceLoc(token:) " )
189180 @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 )
193183 }
194184}
195185
196186extension Optional < TokenSyntax > {
197187 /// Obtains a bridged, `ASTContext`-owned copy of this token's text.
198188 ///
199189 /// - Parameter astgen: The visitor providing the `ASTContext`.
190+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifier(token:) " )
200191 @inline ( __always)
201192 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 )
207194 }
208195
209196 /// Obtains a bridged, `ASTContext`-owned copy of this token's text, and its bridged start location in the
210197 /// source buffer provided by `astgen` excluding leading trivia.
211198 ///
212199 /// - Parameter astgen: The visitor providing the `ASTContext` and source buffer.
200+ @available ( * , deprecated, message: " use ASTContext.bridgedIdentifierAndSourceLoc(token:) " )
213201 @inline ( __always)
214202 func bridgedIdentifierAndSourceLoc( in astgen: ASTGenVisitor ) -> ( BridgedIdentifier , BridgedSourceLoc ) {
215- guard let self else {
216- return ( nil , nil )
217- }
203+ astgen . generateIdentifierAndSourceLoc ( self )
204+ }
205+ }
218206
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)
220212 }
221213}
0 commit comments