Skip to content

Commit 9bee5d1

Browse files
author
Dave Abrahams
committed
[stdlib] location/formLocation => index/formIndex
1 parent debde16 commit 9bee5d1

File tree

171 files changed

+1238
-1238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+1238
-1238
lines changed

benchmark/single-source/StringInterpolation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public func run_StringInterpolation(_ N: Int) {
3434
// FIXME: if String is not stored as UTF-16 on this platform, then the
3535
// following operation has a non-trivial cost and needs to be replaced
3636
// with an operation on the native storage type.
37-
result = result &+ Int(utf16[utf16.location(before: utf16.endIndex)])
37+
result = result &+ Int(utf16[utf16.index(before: utf16.endIndex)])
3838
}
3939
CheckResults(result == refResult, "IncorrectResults in StringInterpolation: \(result) != \(refResult)")
4040
}

stdlib/private/StdlibCollectionUnittest/CheckCollectionInstance.swift.gyb

+15-15
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ public func check${inc.capitalize()}rementable<
7171
checkEquatable(instances, oracle: equalityOracle, ${trace})
7272
for i in instances {
7373
if i != ${end}Index {
74-
let next = baseCollection.location(${direction}: i)
75-
// location(${direction}:) gets us a new index value
74+
let next = baseCollection.index(${direction}: i)
75+
// index(${direction}:) gets us a new index value
7676
expectNotEqual(i, next, ${trace})
7777

78-
// Which is the same as if we apply formLocation(${direction}:)
78+
// Which is the same as if we apply formIndex(${direction}:)
7979
var j = i
80-
baseCollection.formLocation(${direction}: &j)
80+
baseCollection.formIndex(${direction}: &j)
8181
expectEqual(j, next, ${trace})
8282
}
8383
}
@@ -108,8 +108,8 @@ internal func _checkIncrementalAdvance<
108108

109109
var offset: BaseCollection.IndexDistance = 0
110110
for _ in 0...(d * sign).toIntMax() {
111-
let j = baseCollection.location(i, offsetBy: offset)
112-
let k = baseCollection.location(i, offsetBy: offset + sign, limitedBy: limit) ?? limit
111+
let j = baseCollection.index(i, offsetBy: offset)
112+
let k = baseCollection.index(i, offsetBy: offset + sign, limitedBy: limit) ?? limit
113113
let jAtLimit = offset == d
114114
if jAtLimit {
115115
expectEqual(limit, j, ${trace})
@@ -145,7 +145,7 @@ public func checkForwardIndex<
145145

146146
_checkIncrementalAdvance(instances, of: baseCollection,
147147
equalityOracle: equalityOracle, limit: endIndex,
148-
sign: 1, next: { baseCollection.location(after: $0) }, ${trace})
148+
sign: 1, next: { baseCollection.index(after: $0) }, ${trace})
149149
}
150150

151151
/// Test that the elements of `instances` satisfy the semantic requirements of
@@ -179,7 +179,7 @@ public func checkBidirectionalIndex<
179179

180180
_checkIncrementalAdvance(instances, of: baseCollection,
181181
equalityOracle: equalityOracle, limit: startIndex,
182-
sign: -1, next: { baseCollection.location(before: $0) }, ${trace})
182+
sign: -1, next: { baseCollection.index(before: $0) }, ${trace})
183183
}
184184

185185
/// Test that the elements of `instances` satisfy the semantic requirements of
@@ -257,11 +257,11 @@ public func checkAdvancesAndDistances<
257257

258258
for i in instances.indices {
259259
let x = instances[i]
260-
expectEqual(x, baseCollection.location(x, offsetBy: 0))
260+
expectEqual(x, baseCollection.index(x, offsetBy: 0))
261261

262262
for j in distances.indices {
263263
let y = distances[j]
264-
expectEqual(advanceOracle(i, j), baseCollection.location(x, offsetBy: y))
264+
expectEqual(advanceOracle(i, j), baseCollection.index(x, offsetBy: y))
265265
}
266266

267267
for j in instances.indices {
@@ -299,9 +299,9 @@ public func check${Traversal}Collection<
299299
resiliencyChecks: resiliencyChecks, sameValue: sameValue)
300300
}
301301

302-
let succ = { collection.location(after: $0) }
302+
let succ = { collection.index(after: $0) }
303303
% if Traversal != 'Forward':
304-
let pred = { collection.location(before: $0) }
304+
let pred = { collection.index(before: $0) }
305305
% end
306306
// Advances up to 1 positions without passing endIndex. Don't use
307307
// advanced(by: n) to do this because it's under test here.
@@ -347,7 +347,7 @@ public func check${Traversal}Collection<
347347
}
348348

349349
func nextN(_ n: Distance, _ i: C.Index) -> C.Index {
350-
return collection.location(i, offsetBy: n)
350+
return collection.index(i, offsetBy: n)
351351
}
352352

353353
let instances = _allIndices(into: collection, in: partWay0..<partWay1)
@@ -489,8 +489,8 @@ public func checkSliceableWithBidirectionalIndex<
489489

490490
let expectedArray = Array(expected)
491491

492-
let succ = { sliceable.location(after: $0) }
493-
let pred = { sliceable.location(before: $0) }
492+
let succ = { sliceable.index(after: $0) }
493+
let pred = { sliceable.index(before: $0) }
494494

495495
var start = sliceable.startIndex
496496
for startNumericIndex in 0...expectedArray.count {

0 commit comments

Comments
 (0)