[stdlib] Remove _StringCore reference from UnicodeScalarIndex

This removes the `_core` property from UnicodeScalarView.Index
and moves any remaining index-moving logic from the index to
the view in UnicodeScalarView and CharacterView.
This commit is contained in:
Nate Cook
2016-06-29 14:07:56 -05:00
parent ad00a74280
commit 2d75c12c2d
4 changed files with 119 additions and 124 deletions

View File

@@ -96,7 +96,10 @@ extension String {
/// Return an `Index` corresponding to the given offset in our UTF-16
/// representation.
func _index(_ utf16Index: Int) -> Index {
return Index(_base: String.UnicodeScalarView.Index(utf16Index, _core))
return Index(
_base: String.UnicodeScalarView.Index(_position: utf16Index),
in: characters
)
}
/// Return a `Range<Index>` corresponding to the given `NSRange` of