Skip to content

Commit 19c29f6

Browse files
committed
stdlib: mark _ArrayBuffer APIs as internal
1 parent 5178c8e commit 19c29f6

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ internal struct _ArrayBuffer<Element> : _ArrayBufferProtocol {
4646

4747
/// The spare bits that are set when a native array needs deferred
4848
/// element type checking.
49-
var deferredTypeCheckMask: Int { return 1 }
49+
internal var deferredTypeCheckMask: Int { return 1 }
5050

5151
/// Returns an `_ArrayBuffer<U>` containing the same elements,
5252
/// deferring checking each element's `U`-ness until it is accessed.
@@ -68,7 +68,7 @@ internal struct _ArrayBuffer<Element> : _ArrayBufferProtocol {
6868
native: _native._storage, bits: deferredTypeCheckMask))
6969
}
7070

71-
var needsElementTypeCheck: Bool {
71+
internal var needsElementTypeCheck: Bool {
7272
// NSArray's need an element typecheck when the element type isn't AnyObject
7373
return !_isNativeTypeChecked && !(AnyObject.self is Element.Type)
7474
}
@@ -89,12 +89,12 @@ extension _ArrayBuffer {
8989
}
9090

9191
/// `true`, if the array is native and does not need a deferred type check.
92-
var arrayPropertyIsNativeTypeChecked: Bool {
92+
internal var arrayPropertyIsNativeTypeChecked: Bool {
9393
return _isNativeTypeChecked
9494
}
9595

9696
/// Returns `true` iff this buffer's storage is uniquely-referenced.
97-
mutating func isUniquelyReferenced() -> Bool {
97+
internal mutating func isUniquelyReferenced() -> Bool {
9898
if !_isClassOrObjCExistential(Element.self) {
9999
return _storage.isUniquelyReferenced_native_noSpareBits()
100100
}
@@ -103,7 +103,7 @@ extension _ArrayBuffer {
103103

104104
/// Returns `true` iff this buffer's storage is either
105105
/// uniquely-referenced or pinned.
106-
mutating func isUniquelyReferencedOrPinned() -> Bool {
106+
internal mutating func isUniquelyReferencedOrPinned() -> Bool {
107107
if !_isClassOrObjCExistential(Element.self) {
108108
return _storage.isUniquelyReferencedOrPinned_native_noSpareBits()
109109
}
@@ -113,7 +113,7 @@ extension _ArrayBuffer {
113113
/// Convert to an NSArray.
114114
///
115115
/// O(1) if the element type is bridged verbatim, O(N) otherwise.
116-
public func _asCocoaArray() -> _NSArrayCore {
116+
internal func _asCocoaArray() -> _NSArrayCore {
117117
return _fastPath(_isNative) ? _native._asCocoaArray() : _nonNative
118118
}
119119

@@ -170,7 +170,7 @@ extension _ArrayBuffer {
170170
}
171171
}
172172

173-
func _typeCheck(_ subRange: Range<Int>) {
173+
internal func _typeCheck(_ subRange: Range<Int>) {
174174
if !_isClassOrObjCExistential(Element.self) {
175175
return
176176
}
@@ -189,7 +189,7 @@ extension _ArrayBuffer {
189189
/// memory starting at `target`. Return a pointer "past the end" of the
190190
/// just-initialized memory.
191191
@discardableResult
192-
public func _copyContents(
192+
internal func _copyContents(
193193
subRange bounds: Range<Int>,
194194
initializing target: UnsafeMutablePointer<Element>
195195
) -> UnsafeMutablePointer<Element> {
@@ -273,17 +273,17 @@ extension _ArrayBuffer {
273273
/// A pointer to the first element.
274274
///
275275
/// - Precondition: The elements are known to be stored contiguously.
276-
public var firstElementAddress: UnsafeMutablePointer<Element> {
276+
internal var firstElementAddress: UnsafeMutablePointer<Element> {
277277
_sanityCheck(_isNative, "must be a native buffer")
278278
return _native.firstElementAddress
279279
}
280280

281-
public var firstElementAddressIfContiguous: UnsafeMutablePointer<Element>? {
281+
internal var firstElementAddressIfContiguous: UnsafeMutablePointer<Element>? {
282282
return _fastPath(_isNative) ? firstElementAddress : nil
283283
}
284284

285285
/// The number of elements the buffer stores.
286-
public var count: Int {
286+
internal var count: Int {
287287
@inline(__always)
288288
get {
289289
return _fastPath(_isNative) ? _native.count : _nonNative.count
@@ -331,13 +331,13 @@ extension _ArrayBuffer {
331331
}
332332

333333
/// The number of elements the buffer can store without reallocation.
334-
public var capacity: Int {
334+
internal var capacity: Int {
335335
return _fastPath(_isNative) ? _native.capacity : _nonNative.count
336336
}
337337

338338
@_versioned
339339
@inline(__always)
340-
func getElement(_ i: Int, wasNativeTypeChecked: Bool) -> Element {
340+
internal func getElement(_ i: Int, wasNativeTypeChecked: Bool) -> Element {
341341
if _fastPath(wasNativeTypeChecked) {
342342
return _nativeTypeChecked[i]
343343
}
@@ -346,7 +346,7 @@ extension _ArrayBuffer {
346346

347347
@_versioned
348348
@inline(never)
349-
func _getElementSlowPath(_ i: Int) -> AnyObject {
349+
internal func _getElementSlowPath(_ i: Int) -> AnyObject {
350350
_sanityCheck(
351351
_isClassOrObjCExistential(Element.self),
352352
"Only single reference elements can be indexed here.")
@@ -372,7 +372,7 @@ extension _ArrayBuffer {
372372
}
373373

374374
/// Get or set the value of the ith element.
375-
public subscript(i: Int) -> Element {
375+
internal subscript(i: Int) -> Element {
376376
get {
377377
return getElement(i, wasNativeTypeChecked: _isNativeTypeChecked)
378378
}
@@ -394,7 +394,7 @@ extension _ArrayBuffer {
394394
/// Call `body(p)`, where `p` is an `UnsafeBufferPointer` over the
395395
/// underlying contiguous storage. If no such storage exists, it is
396396
/// created on-demand.
397-
public func withUnsafeBufferPointer<R>(
397+
internal func withUnsafeBufferPointer<R>(
398398
_ body: (UnsafeBufferPointer<Element>) throws -> R
399399
) rethrows -> R {
400400
if _fastPath(_isNative) {
@@ -409,7 +409,7 @@ extension _ArrayBuffer {
409409
/// over the underlying contiguous storage.
410410
///
411411
/// - Precondition: Such contiguous storage exists or the buffer is empty.
412-
public mutating func withUnsafeMutableBufferPointer<R>(
412+
internal mutating func withUnsafeMutableBufferPointer<R>(
413413
_ body: (UnsafeMutableBufferPointer<Element>) throws -> R
414414
) rethrows -> R {
415415
_sanityCheck(
@@ -422,22 +422,22 @@ extension _ArrayBuffer {
422422
}
423423

424424
/// An object that keeps the elements stored in this buffer alive.
425-
public var owner: AnyObject {
425+
internal var owner: AnyObject {
426426
return _fastPath(_isNative) ? _native._storage : _nonNative
427427
}
428428

429429
/// An object that keeps the elements stored in this buffer alive.
430430
///
431431
/// - Precondition: This buffer is backed by a `_ContiguousArrayBuffer`.
432-
public var nativeOwner: AnyObject {
432+
internal var nativeOwner: AnyObject {
433433
_sanityCheck(_isNative, "Expect a native array")
434434
return _native._storage
435435
}
436436

437437
/// A value that identifies the storage used by the buffer. Two
438438
/// buffers address the same elements when they have the same
439439
/// identity and count.
440-
public var identity: UnsafeRawPointer {
440+
internal var identity: UnsafeRawPointer {
441441
if _isNative {
442442
return _native.identity
443443
}
@@ -450,7 +450,7 @@ extension _ArrayBuffer {
450450
/// The position of the first element in a non-empty collection.
451451
///
452452
/// In an empty collection, `startIndex == endIndex`.
453-
public var startIndex: Int {
453+
internal var startIndex: Int {
454454
return 0
455455
}
456456

@@ -459,18 +459,18 @@ extension _ArrayBuffer {
459459
/// `endIndex` is not a valid argument to `subscript`, and is always
460460
/// reachable from `startIndex` by zero or more applications of
461461
/// `index(after:)`.
462-
public var endIndex: Int {
462+
internal var endIndex: Int {
463463
return count
464464
}
465465

466-
public typealias Indices = CountableRange<Int>
466+
internal typealias Indices = CountableRange<Int>
467467

468468
//===--- private --------------------------------------------------------===//
469469
internal typealias Storage = _ContiguousArrayStorage<Element>
470470
internal typealias NativeBuffer = _ContiguousArrayBuffer<Element>
471471

472472
@_versioned
473-
var _isNative: Bool {
473+
internal var _isNative: Bool {
474474
if !_isClassOrObjCExistential(Element.self) {
475475
return true
476476
} else {
@@ -479,7 +479,7 @@ extension _ArrayBuffer {
479479
}
480480

481481
/// `true`, if the array is native and does not need a deferred type check.
482-
var _isNativeTypeChecked: Bool {
482+
internal var _isNativeTypeChecked: Bool {
483483
if !_isClassOrObjCExistential(Element.self) {
484484
return true
485485
} else {
@@ -491,7 +491,7 @@ extension _ArrayBuffer {
491491
///
492492
/// - Precondition: `_isNative`.
493493
@_versioned
494-
var _native: NativeBuffer {
494+
internal var _native: NativeBuffer {
495495
return NativeBuffer(
496496
_isClassOrObjCExistential(Element.self)
497497
? _storage.nativeInstance : _storage.nativeInstance_noSpareBits)
@@ -501,12 +501,12 @@ extension _ArrayBuffer {
501501
///
502502
/// - Precondition: `_isNativeTypeChecked`.
503503
@_versioned
504-
var _nativeTypeChecked: NativeBuffer {
504+
internal var _nativeTypeChecked: NativeBuffer {
505505
return NativeBuffer(_storage.nativeInstance_noSpareBits)
506506
}
507507

508508
@_versioned
509-
var _nonNative: _NSArrayCore {
509+
internal var _nonNative: _NSArrayCore {
510510
@inline(__always)
511511
get {
512512
_sanityCheck(_isClassOrObjCExistential(Element.self))

0 commit comments

Comments
 (0)