[String] Refactor helper code into UnicodeHelpers.swift.

Clean up some of the index assumptions, stick index-aware methods on
_StringGuts, and otherwise migrate code over to UnicodeHelpers.swift.
This commit is contained in:
Michael Ilseman
2018-10-15 13:22:35 -07:00
parent de893b66a2
commit 89d18e1a3a
11 changed files with 644 additions and 211 deletions

View File

@@ -341,3 +341,17 @@ extension _StringGuts {
}
}
// Index
extension _StringGuts {
@usableFromInline
internal typealias Index = String.Index
@inlinable
internal var startIndex: String.Index {
@inline(__always) get { return Index(encodedOffset: 0) }
}
@inlinable
internal var endIndex: String.Index {
@inline(__always) get { return Index(encodedOffset: self.count) }
}
}