Skip to content

Commit 9705ccb

Browse files
committed
stdlib: add underscores to an initializer on ArrayBufferProtocol
1 parent 609ba73 commit 9705ccb

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

stdlib/public/core/ArrayBuffer.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public struct _ArrayBuffer<Element> : _ArrayBufferProtocol {
8383

8484
extension _ArrayBuffer {
8585
/// Adopt the storage of `source`.
86-
public init(_ source: NativeBuffer, shiftedToStartIndex: Int) {
86+
public init(_buffer source: NativeBuffer, shiftedToStartIndex: Int) {
8787
_sanityCheck(shiftedToStartIndex == 0, "shiftedToStartIndex must be 0")
8888
_storage = _ArrayBridgeStorage(native: source._storage)
8989
}
@@ -232,7 +232,7 @@ extension _ArrayBuffer {
232232
let boundsCount = bounds.count
233233
if boundsCount == 0 {
234234
return _SliceBuffer(
235-
_ContiguousArrayBuffer<Element>(),
235+
_buffer: _ContiguousArrayBuffer<Element>(),
236236
shiftedToStartIndex: bounds.lowerBound)
237237
}
238238

@@ -262,7 +262,8 @@ extension _ArrayBuffer {
262262
.assumingMemoryBound(to: AnyObject.self),
263263
range: _SwiftNSRange(location: bounds.lowerBound, length: boundsCount))
264264

265-
return _SliceBuffer(result, shiftedToStartIndex: bounds.lowerBound)
265+
return _SliceBuffer(
266+
_buffer: result, shiftedToStartIndex: bounds.lowerBound)
266267
}
267268
set {
268269
fatalError("not implemented")

stdlib/public/core/ArrayBufferProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public protocol _ArrayBufferProtocol
2424
init()
2525

2626
/// Adopt the entire buffer, presenting it at the provided `startIndex`.
27-
init(_ buffer: _ContiguousArrayBuffer<Element>, shiftedToStartIndex: Int)
27+
init(_buffer: _ContiguousArrayBuffer<Element>, shiftedToStartIndex: Int)
2828

2929
/// Copy the elements in `bounds` from this buffer into uninitialized
3030
/// memory starting at `target`. Return a pointer "past the end" of the

stdlib/public/core/Arrays.swift.gyb

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,8 @@ public struct ${Self}<Element>
786786
buffer._copyContents(
787787
subRange: Range(buffer.indices),
788788
initializing: newBuffer.firstElementAddress)
789-
buffer = _Buffer(newBuffer, shiftedToStartIndex: buffer.startIndex)
789+
buffer = _Buffer(
790+
_buffer: newBuffer, shiftedToStartIndex: buffer.startIndex)
790791
}
791792

792793
@_semantics("array.make_mutable")
@@ -885,8 +886,8 @@ public struct ${Self}<Element>
885886
/// Initialization from an existing buffer does not have "array.init"
886887
/// semantics because the caller may retain an alias to buffer.
887888
public // @testable
888-
init(_buffer: _ContiguousArrayBuffer<Element>) {
889-
self.init(_buffer: _Buffer(_buffer, shiftedToStartIndex: 0))
889+
init(_buffer buffer: _ContiguousArrayBuffer<Element>) {
890+
self.init(_buffer: _Buffer(_buffer: buffer, shiftedToStartIndex: 0))
890891
}
891892
%end
892893

@@ -1031,7 +1032,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
10311032

10321033
self = ${Self}(
10331034
_buffer: _Buffer(
1034-
s._copyToContiguousArray()._buffer,
1035+
_buffer: s._copyToContiguousArray()._buffer,
10351036
shiftedToStartIndex: 0))
10361037
}
10371038

@@ -1065,7 +1066,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
10651066
) -> _Buffer {
10661067
let newBuffer = _ContiguousArrayBuffer<Element>(
10671068
uninitializedCount: 0, minimumCapacity: minimumCapacity)
1068-
return _Buffer(newBuffer, shiftedToStartIndex: 0)
1069+
return _Buffer(_buffer: newBuffer, shiftedToStartIndex: 0)
10691070
}
10701071

10711072
/// Construct a ${Self} of `count` uninitialized elements.
@@ -1118,7 +1119,8 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
11181119
storage, to: _ContiguousArrayStorage<Element>.self))
11191120

11201121
return (
1121-
Array(_buffer: _Buffer(innerBuffer, shiftedToStartIndex: 0)),
1122+
Array(
1123+
_buffer: _Buffer(_buffer: innerBuffer, shiftedToStartIndex: 0)),
11221124
innerBuffer.firstElementAddress)
11231125
}
11241126

@@ -1203,7 +1205,8 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
12031205
_buffer._copyContents(
12041206
subRange: Range(_buffer.indices),
12051207
initializing: newBuffer.firstElementAddress)
1206-
_buffer = _Buffer(newBuffer, shiftedToStartIndex: _buffer.startIndex)
1208+
_buffer = _Buffer(
1209+
_buffer: newBuffer, shiftedToStartIndex: _buffer.startIndex)
12071210
}
12081211
_sanityCheck(capacity >= minimumCapacity)
12091212
}
@@ -1933,7 +1936,7 @@ internal func _arrayOutOfPlaceUpdate<_Buffer, Initializer>(
19331936
let tailEnd = source.endIndex
19341937
source._copyContents(subRange: tailStart..<tailEnd, initializing: newEnd)
19351938
}
1936-
source = _Buffer(dest, shiftedToStartIndex: source.startIndex)
1939+
source = _Buffer(_buffer: dest, shiftedToStartIndex: source.startIndex)
19371940
}
19381941

19391942
internal struct _InitializePointer<T> : _PointerFunction {
@@ -2159,7 +2162,7 @@ extension ArraySlice {
21592162
init(_startIndex: Int) {
21602163
self.init(
21612164
_buffer: _Buffer(
2162-
ContiguousArray()._buffer,
2165+
_buffer: ContiguousArray()._buffer,
21632166
shiftedToStartIndex: _startIndex))
21642167
}
21652168
}

stdlib/public/core/ContiguousArrayBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ struct _ContiguousArrayBuffer<Element> : _ArrayBufferProtocol {
288288
_uncheckedUnsafeBufferObject: _emptyArrayStorage)
289289
}
290290

291-
public init(_ buffer: _ContiguousArrayBuffer, shiftedToStartIndex: Int) {
291+
public init(_buffer buffer: _ContiguousArrayBuffer, shiftedToStartIndex: Int) {
292292
_sanityCheck(shiftedToStartIndex == 0, "shiftedToStartIndex must be 0")
293293
self = buffer
294294
}

stdlib/public/core/SliceBuffer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct _SliceBuffer<Element> : _ArrayBufferProtocol, RandomAccessCollection {
3737
_invariantCheck()
3838
}
3939

40-
public init(_ buffer: NativeBuffer, shiftedToStartIndex: Int) {
40+
public init(_buffer buffer: NativeBuffer, shiftedToStartIndex: Int) {
4141
let shift = buffer.startIndex - shiftedToStartIndex
4242
self.init(
4343
owner: buffer.owner,

0 commit comments

Comments
 (0)