Skip to content

Changes for SE-0125: Remove NonObjectiveCBase and isUniquelyReferenced #467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Foundation/Boxing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ extension _MutableBoxing {
@inline(__always)
mutating func _applyMutation<ReturnType>(_ whatToDo : @noescape(ReferenceType) -> ReturnType) -> ReturnType {
// Only create a new box if we are not uniquely referenced
if !isUniquelyReferencedNonObjC(&_handle) {
if !isKnownUniquelyReferenced(&_handle) {
let ref = _handle._pointer
_handle = _MutableHandle(reference: ref)
}
Expand Down Expand Up @@ -185,7 +185,7 @@ extension _MutablePairBoxing {
case .Immutable(_):
break
case .Mutable(_):
unique = isUniquelyReferencedNonObjC(&_wrapped)
unique = isKnownUniquelyReferenced(&_wrapped)
}

switch (wrapper) {
Expand Down
2 changes: 1 addition & 1 deletion Foundation/IndexSet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ public struct IndexSet : ReferenceConvertible, Equatable, BidirectionalCollectio
return result
case .Mutable(let m):
// Only create a new box if we are not uniquely referenced
if !isUniquelyReferencedNonObjC(&_handle) {
if !isKnownUniquelyReferenced(&_handle) {
let copy = m.mutableCopy(with: nil) as! NSMutableIndexSet
_handle = _MutablePairHandle(copy, copying: false)
let result = try whatToDo(copy)
Expand Down
2 changes: 1 addition & 1 deletion Foundation/URLRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public struct URLRequest : ReferenceConvertible, CustomStringConvertible, Equata
internal var _handle: _MutableHandle<NSMutableURLRequest>

internal mutating func _applyMutation<ReturnType>(_ whatToDo : @noescape (NSMutableURLRequest) -> ReturnType) -> ReturnType {
if !isUniquelyReferencedNonObjC(&_handle) {
if !isKnownUniquelyReferenced(&_handle) {
let ref = _handle._uncopiedReference()
_handle = _MutableHandle(reference: ref)
}
Expand Down