mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
e5cf99088b
Diff: https://github.com/apple/swift-syntax/compare/509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-05-02-a...509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-06-05-a
16 lines
728 B
Swift
16 lines
728 B
Swift
import SwiftSyntax
|
|
|
|
public extension SourceRange {
|
|
/// Check if a position is contained within this range.
|
|
///
|
|
/// - parameter position: The position to check.
|
|
/// - parameter locationConverter: The location converter to use to perform the check.
|
|
///
|
|
/// - returns: Whether the specified position is contained within this range.
|
|
func contains(_ position: AbsolutePosition, locationConverter: SourceLocationConverter) -> Bool {
|
|
let startPosition = locationConverter.position(ofLine: start.line, column: start.column)
|
|
let endPosition = locationConverter.position(ofLine: end.line, column: end.column)
|
|
return startPosition <= position && position <= endPosition
|
|
}
|
|
}
|