stdlib: mark _ArrayBuffer APIs as internal
diff --git a/stdlib/public/core/ArrayBuffer.swift b/stdlib/public/core/ArrayBuffer.swift
index 1916a6c..4ec63b9 100644
--- a/stdlib/public/core/ArrayBuffer.swift
+++ b/stdlib/public/core/ArrayBuffer.swift
@@ -46,7 +46,7 @@
/// The spare bits that are set when a native array needs deferred
/// element type checking.
- var deferredTypeCheckMask: Int { return 1 }
+ internal var deferredTypeCheckMask: Int { return 1 }
/// Returns an `_ArrayBuffer<U>` containing the same elements,
/// deferring checking each element's `U`-ness until it is accessed.
@@ -68,7 +68,7 @@
native: _native._storage, bits: deferredTypeCheckMask))
}
- var needsElementTypeCheck: Bool {
+ internal var needsElementTypeCheck: Bool {
// NSArray's need an element typecheck when the element type isn't AnyObject
return !_isNativeTypeChecked && !(AnyObject.self is Element.Type)
}
@@ -89,12 +89,12 @@
}
/// `true`, if the array is native and does not need a deferred type check.
- var arrayPropertyIsNativeTypeChecked: Bool {
+ internal var arrayPropertyIsNativeTypeChecked: Bool {
return _isNativeTypeChecked
}
/// Returns `true` iff this buffer's storage is uniquely-referenced.
- mutating func isUniquelyReferenced() -> Bool {
+ internal mutating func isUniquelyReferenced() -> Bool {
if !_isClassOrObjCExistential(Element.self) {
return _storage.isUniquelyReferenced_native_noSpareBits()
}
@@ -103,7 +103,7 @@
/// Returns `true` iff this buffer's storage is either
/// uniquely-referenced or pinned.
- mutating func isUniquelyReferencedOrPinned() -> Bool {
+ internal mutating func isUniquelyReferencedOrPinned() -> Bool {
if !_isClassOrObjCExistential(Element.self) {
return _storage.isUniquelyReferencedOrPinned_native_noSpareBits()
}
@@ -113,7 +113,7 @@
/// Convert to an NSArray.
///
/// O(1) if the element type is bridged verbatim, O(N) otherwise.
- public func _asCocoaArray() -> _NSArrayCore {
+ internal func _asCocoaArray() -> _NSArrayCore {
return _fastPath(_isNative) ? _native._asCocoaArray() : _nonNative
}
@@ -170,7 +170,7 @@
}
}
- func _typeCheck(_ subRange: Range<Int>) {
+ internal func _typeCheck(_ subRange: Range<Int>) {
if !_isClassOrObjCExistential(Element.self) {
return
}
@@ -189,7 +189,7 @@
/// memory starting at `target`. Return a pointer "past the end" of the
/// just-initialized memory.
@discardableResult
- public func _copyContents(
+ internal func _copyContents(
subRange bounds: Range<Int>,
initializing target: UnsafeMutablePointer<Element>
) -> UnsafeMutablePointer<Element> {
@@ -273,17 +273,17 @@
/// A pointer to the first element.
///
/// - Precondition: The elements are known to be stored contiguously.
- public var firstElementAddress: UnsafeMutablePointer<Element> {
+ internal var firstElementAddress: UnsafeMutablePointer<Element> {
_sanityCheck(_isNative, "must be a native buffer")
return _native.firstElementAddress
}
- public var firstElementAddressIfContiguous: UnsafeMutablePointer<Element>? {
+ internal var firstElementAddressIfContiguous: UnsafeMutablePointer<Element>? {
return _fastPath(_isNative) ? firstElementAddress : nil
}
/// The number of elements the buffer stores.
- public var count: Int {
+ internal var count: Int {
@inline(__always)
get {
return _fastPath(_isNative) ? _native.count : _nonNative.count
@@ -331,13 +331,13 @@
}
/// The number of elements the buffer can store without reallocation.
- public var capacity: Int {
+ internal var capacity: Int {
return _fastPath(_isNative) ? _native.capacity : _nonNative.count
}
@_versioned
@inline(__always)
- func getElement(_ i: Int, wasNativeTypeChecked: Bool) -> Element {
+ internal func getElement(_ i: Int, wasNativeTypeChecked: Bool) -> Element {
if _fastPath(wasNativeTypeChecked) {
return _nativeTypeChecked[i]
}
@@ -346,7 +346,7 @@
@_versioned
@inline(never)
- func _getElementSlowPath(_ i: Int) -> AnyObject {
+ internal func _getElementSlowPath(_ i: Int) -> AnyObject {
_sanityCheck(
_isClassOrObjCExistential(Element.self),
"Only single reference elements can be indexed here.")
@@ -372,7 +372,7 @@
}
/// Get or set the value of the ith element.
- public subscript(i: Int) -> Element {
+ internal subscript(i: Int) -> Element {
get {
return getElement(i, wasNativeTypeChecked: _isNativeTypeChecked)
}
@@ -394,7 +394,7 @@
/// Call `body(p)`, where `p` is an `UnsafeBufferPointer` over the
/// underlying contiguous storage. If no such storage exists, it is
/// created on-demand.
- public func withUnsafeBufferPointer<R>(
+ internal func withUnsafeBufferPointer<R>(
_ body: (UnsafeBufferPointer<Element>) throws -> R
) rethrows -> R {
if _fastPath(_isNative) {
@@ -409,7 +409,7 @@
/// over the underlying contiguous storage.
///
/// - Precondition: Such contiguous storage exists or the buffer is empty.
- public mutating func withUnsafeMutableBufferPointer<R>(
+ internal mutating func withUnsafeMutableBufferPointer<R>(
_ body: (UnsafeMutableBufferPointer<Element>) throws -> R
) rethrows -> R {
_sanityCheck(
@@ -422,14 +422,14 @@
}
/// An object that keeps the elements stored in this buffer alive.
- public var owner: AnyObject {
+ internal var owner: AnyObject {
return _fastPath(_isNative) ? _native._storage : _nonNative
}
/// An object that keeps the elements stored in this buffer alive.
///
/// - Precondition: This buffer is backed by a `_ContiguousArrayBuffer`.
- public var nativeOwner: AnyObject {
+ internal var nativeOwner: AnyObject {
_sanityCheck(_isNative, "Expect a native array")
return _native._storage
}
@@ -437,7 +437,7 @@
/// A value that identifies the storage used by the buffer. Two
/// buffers address the same elements when they have the same
/// identity and count.
- public var identity: UnsafeRawPointer {
+ internal var identity: UnsafeRawPointer {
if _isNative {
return _native.identity
}
@@ -450,7 +450,7 @@
/// The position of the first element in a non-empty collection.
///
/// In an empty collection, `startIndex == endIndex`.
- public var startIndex: Int {
+ internal var startIndex: Int {
return 0
}
@@ -459,18 +459,18 @@
/// `endIndex` is not a valid argument to `subscript`, and is always
/// reachable from `startIndex` by zero or more applications of
/// `index(after:)`.
- public var endIndex: Int {
+ internal var endIndex: Int {
return count
}
- public typealias Indices = CountableRange<Int>
+ internal typealias Indices = CountableRange<Int>
//===--- private --------------------------------------------------------===//
internal typealias Storage = _ContiguousArrayStorage<Element>
internal typealias NativeBuffer = _ContiguousArrayBuffer<Element>
@_versioned
- var _isNative: Bool {
+ internal var _isNative: Bool {
if !_isClassOrObjCExistential(Element.self) {
return true
} else {
@@ -479,7 +479,7 @@
}
/// `true`, if the array is native and does not need a deferred type check.
- var _isNativeTypeChecked: Bool {
+ internal var _isNativeTypeChecked: Bool {
if !_isClassOrObjCExistential(Element.self) {
return true
} else {
@@ -491,7 +491,7 @@
///
/// - Precondition: `_isNative`.
@_versioned
- var _native: NativeBuffer {
+ internal var _native: NativeBuffer {
return NativeBuffer(
_isClassOrObjCExistential(Element.self)
? _storage.nativeInstance : _storage.nativeInstance_noSpareBits)
@@ -501,12 +501,12 @@
///
/// - Precondition: `_isNativeTypeChecked`.
@_versioned
- var _nativeTypeChecked: NativeBuffer {
+ internal var _nativeTypeChecked: NativeBuffer {
return NativeBuffer(_storage.nativeInstance_noSpareBits)
}
@_versioned
- var _nonNative: _NSArrayCore {
+ internal var _nonNative: _NSArrayCore {
@inline(__always)
get {
_sanityCheck(_isClassOrObjCExistential(Element.self))