@@ -227,8 +227,14 @@ public final class SourceLocationConverter {
227
227
}
228
228
}
229
229
230
- extension _SyntaxBase {
231
- func startLocation(
230
+ extension Syntax {
231
+ /// The starting location, in the provided file, of this Syntax node.
232
+ /// - Parameters:
233
+ /// - converter: The `SourceLocationConverter` that was previously
234
+ /// initialized using the root tree of this node.
235
+ /// - afterLeadingTrivia: Whether to skip leading trivia when getting
236
+ /// the node's location. Defaults to `true`.
237
+ public func startLocation(
232
238
converter: SourceLocationConverter ,
233
239
afterLeadingTrivia: Bool = true
234
240
) -> SourceLocation {
@@ -238,7 +244,13 @@ extension _SyntaxBase {
238
244
return converter. location ( for: pos)
239
245
}
240
246
241
- func endLocation(
247
+ /// The ending location, in the provided file, of this Syntax node.
248
+ /// - Parameters:
249
+ /// - converter: The `SourceLocationConverter` that was previously
250
+ /// initialized using the root tree of this node.
251
+ /// - afterTrailingTrivia: Whether to skip trailing trivia when getting
252
+ /// the node's location. Defaults to `false`.
253
+ public func endLocation(
242
254
converter: SourceLocationConverter ,
243
255
afterTrailingTrivia: Bool = false
244
256
) -> SourceLocation {
@@ -251,7 +263,15 @@ extension _SyntaxBase {
251
263
return converter. location ( for: pos)
252
264
}
253
265
254
- func sourceRange(
266
+ /// The source range, in the provided file, of this Syntax node.
267
+ /// - Parameters:
268
+ /// - converter: The `SourceLocationConverter` that was previously
269
+ /// initialized using the root tree of this node.
270
+ /// - afterLeadingTrivia: Whether to skip leading trivia when getting
271
+ /// the node's start location. Defaults to `true`.
272
+ /// - afterTrailingTrivia: Whether to skip trailing trivia when getting
273
+ /// the node's end location. Defaults to `false`.
274
+ public func sourceRange(
255
275
converter: SourceLocationConverter ,
256
276
afterLeadingTrivia: Bool = true ,
257
277
afterTrailingTrivia: Bool = false
@@ -262,19 +282,19 @@ extension _SyntaxBase {
262
282
}
263
283
}
264
284
265
- extension Syntax {
285
+ public extension _SpecializedSyntaxMixin {
266
286
/// The starting location, in the provided file, of this Syntax node.
267
287
/// - Parameters:
268
288
/// - converter: The `SourceLocationConverter` that was previously
269
289
/// initialized using the root tree of this node.
270
290
/// - afterLeadingTrivia: Whether to skip leading trivia when getting
271
291
/// the node's location. Defaults to `true`.
272
- public func startLocation(
292
+ func startLocation(
273
293
converter: SourceLocationConverter ,
274
294
afterLeadingTrivia: Bool = true
275
295
) -> SourceLocation {
276
- return base . startLocation ( converter: converter,
277
- afterLeadingTrivia: afterLeadingTrivia)
296
+ return self . asSyntax . startLocation ( converter: converter,
297
+ afterLeadingTrivia: afterLeadingTrivia)
278
298
}
279
299
280
300
/// The ending location, in the provided file, of this Syntax node.
@@ -283,12 +303,12 @@ extension Syntax {
283
303
/// initialized using the root tree of this node.
284
304
/// - afterTrailingTrivia: Whether to skip trailing trivia when getting
285
305
/// the node's location. Defaults to `false`.
286
- public func endLocation(
306
+ func endLocation(
287
307
converter: SourceLocationConverter ,
288
308
afterTrailingTrivia: Bool = false
289
309
) -> SourceLocation {
290
- return base . endLocation ( converter: converter,
291
- afterTrailingTrivia: afterTrailingTrivia)
310
+ return self . asSyntax . endLocation ( converter: converter,
311
+ afterTrailingTrivia: afterTrailingTrivia)
292
312
}
293
313
294
314
/// The source range, in the provided file, of this Syntax node.
@@ -299,14 +319,14 @@ extension Syntax {
299
319
/// the node's start location. Defaults to `true`.
300
320
/// - afterTrailingTrivia: Whether to skip trailing trivia when getting
301
321
/// the node's end location. Defaults to `false`.
302
- public func sourceRange(
322
+ func sourceRange(
303
323
converter: SourceLocationConverter ,
304
324
afterLeadingTrivia: Bool = true ,
305
325
afterTrailingTrivia: Bool = false
306
326
) -> SourceRange {
307
- return base . sourceRange ( converter: converter,
308
- afterLeadingTrivia: afterLeadingTrivia,
309
- afterTrailingTrivia: afterTrailingTrivia)
327
+ return self . asSyntax . sourceRange ( converter: converter,
328
+ afterLeadingTrivia: afterLeadingTrivia,
329
+ afterTrailingTrivia: afterTrailingTrivia)
310
330
}
311
331
}
312
332
0 commit comments