Skip to content

Commit da0413e

Browse files
committed
undo renaming
1 parent 3967982 commit da0413e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Sources/ComposableArchitecture/Internal/CurrentValueRelay.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import Foundation
44
final class CurrentValueRelay<Output>: Publisher {
55
typealias Failure = Never
66

7-
private var _value: Output
7+
private var currentValue: Output
88
private let lock: os_unfair_lock_t
99
private var subscriptions = ContiguousArray<Subscription>()
1010

1111
var value: Output {
12-
get { self.lock.sync { self._value } }
12+
get { self.lock.sync { self.currentValue } }
1313
set { self.send(newValue) }
1414
}
1515

1616
init(_ value: Output) {
17-
self._value = value
17+
self.currentValue = value
1818
self.lock = os_unfair_lock_t.allocate(capacity: 1)
1919
self.lock.initialize(to: os_unfair_lock())
2020
}
@@ -34,7 +34,7 @@ final class CurrentValueRelay<Output>: Publisher {
3434

3535
func send(_ value: Output) {
3636
self.lock.sync {
37-
self._value = value
37+
self.currentValue = value
3838
}
3939
for subscription in self.lock.sync({ self.subscriptions }) {
4040
subscription.receive(value)
@@ -52,7 +52,7 @@ final class CurrentValueRelay<Output>: Publisher {
5252

5353
extension CurrentValueRelay {
5454
fileprivate final class Subscription: Combine.Subscription, Equatable {
55-
private var _demand = Subscribers.Demand.none
55+
private var demand = Subscribers.Demand.none
5656

5757
private var _downstream: (any Subscriber<Output, Never>)?
5858
var downstream: (any Subscriber<Output, Never>)? {
@@ -89,7 +89,7 @@ extension CurrentValueRelay {
8989
guard let downstream else { return }
9090

9191
self.lock.lock()
92-
switch self._demand {
92+
switch self.demand {
9393
case .unlimited:
9494
self.lock.unlock()
9595
// NB: Adding to unlimited demand has no effect and can be ignored.
@@ -101,11 +101,11 @@ extension CurrentValueRelay {
101101

102102
default:
103103
self.receivedLastValue = true
104-
self._demand -= 1
104+
self.demand -= 1
105105
self.lock.unlock()
106106
let moreDemand = downstream.receive(value)
107107
self.lock.sync {
108-
self._demand += moreDemand
108+
self.demand += moreDemand
109109
}
110110
}
111111
}
@@ -116,7 +116,7 @@ extension CurrentValueRelay {
116116
guard let downstream else { return }
117117

118118
self.lock.lock()
119-
self._demand += demand
119+
self.demand += demand
120120

121121
guard
122122
!self.receivedLastValue,
@@ -128,18 +128,18 @@ extension CurrentValueRelay {
128128

129129
self.receivedLastValue = true
130130

131-
switch self._demand {
131+
switch self.demand {
132132
case .unlimited:
133133
self.lock.unlock()
134134
// NB: Adding to unlimited demand has no effect and can be ignored.
135135
_ = downstream.receive(value)
136136

137137
default:
138-
self._demand -= 1
138+
self.demand -= 1
139139
self.lock.unlock()
140140
let moreDemand = downstream.receive(value)
141141
self.lock.lock()
142-
self._demand += moreDemand
142+
self.demand += moreDemand
143143
self.lock.unlock()
144144
}
145145
}

0 commit comments

Comments
 (0)