Skip to content

Commit d9eb1f6

Browse files
committed
wip
1 parent 712fa8d commit d9eb1f6

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Sources/ComposableArchitecture/Core.swift

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ final class InvalidCore<State, Action>: Core {
2222
}
2323
func send(_ action: Action) -> Task<Void, Never>? { nil }
2424

25+
@inlinable
26+
@inline(__always)
2527
var canStoreCacheChildren: Bool { false }
2628
let didSet = CurrentValueRelay<Void>(())
29+
@inlinable
30+
@inline(__always)
2731
var isInvalid: Bool { true }
32+
@inlinable
33+
@inline(__always)
2834
var effectCancellables: [UUID: AnyCancellable] { [:] }
2935
}
3036

@@ -36,8 +42,12 @@ final class RootCore<Root: Reducer>: Core {
3642
}
3743
let reducer: Root
3844

45+
@inlinable
46+
@inline(__always)
3947
var canStoreCacheChildren: Bool { true }
4048
let didSet = CurrentValueRelay(())
49+
@inlinable
50+
@inline(__always)
4151
var isInvalid: Bool { false }
4252

4353
private var bufferedActions: [Root.Action] = []
@@ -194,21 +204,33 @@ final class ScopedCore<Base: Core, State, Action>: Core {
194204
self.stateKeyPath = stateKeyPath
195205
self.actionKeyPath = actionKeyPath
196206
}
207+
@inlinable
208+
@inline(__always)
197209
var state: State {
198210
base.state[keyPath: stateKeyPath]
199211
}
212+
@inlinable
213+
@inline(__always)
200214
func send(_ action: Action) -> Task<Void, Never>? {
201215
base.send(actionKeyPath(action))
202216
}
217+
@inlinable
218+
@inline(__always)
203219
var canStoreCacheChildren: Bool {
204220
base.canStoreCacheChildren
205221
}
222+
@inlinable
223+
@inline(__always)
206224
var didSet: CurrentValueRelay<Void> {
207225
base.didSet
208226
}
227+
@inlinable
228+
@inline(__always)
209229
var isInvalid: Bool {
210230
base.isInvalid
211231
}
232+
@inlinable
233+
@inline(__always)
212234
var effectCancellables: [UUID: AnyCancellable] {
213235
base.effectCancellables
214236
}
@@ -231,11 +253,15 @@ final class IfLetCore<Base: Core, State, Action>: Core {
231253
self.stateKeyPath = stateKeyPath
232254
self.actionKeyPath = actionKeyPath
233255
}
256+
@inlinable
257+
@inline(__always)
234258
var state: State {
235259
let state = base.state[keyPath: stateKeyPath] ?? cachedState
236260
cachedState = state
237261
return state
238262
}
263+
@inlinable
264+
@inline(__always)
239265
func send(_ action: Action) -> Task<Void, Never>? {
240266
#if DEBUG
241267
if BindingLocal.isActive && isInvalid {
@@ -244,15 +270,23 @@ final class IfLetCore<Base: Core, State, Action>: Core {
244270
#endif
245271
return base.send(actionKeyPath(action))
246272
}
273+
@inlinable
274+
@inline(__always)
247275
var canStoreCacheChildren: Bool {
248276
base.canStoreCacheChildren
249277
}
278+
@inlinable
279+
@inline(__always)
250280
var didSet: CurrentValueRelay<Void> {
251281
base.didSet
252282
}
283+
@inlinable
284+
@inline(__always)
253285
var isInvalid: Bool {
254286
base.state[keyPath: stateKeyPath] == nil || base.isInvalid
255287
}
288+
@inlinable
289+
@inline(__always)
256290
var effectCancellables: [UUID: AnyCancellable] {
257291
base.effectCancellables
258292
}
@@ -271,21 +305,33 @@ final class ClosureScopedCore<Base: Core, State, Action>: Core {
271305
self.toState = toState
272306
self.fromAction = fromAction
273307
}
308+
@inlinable
309+
@inline(__always)
274310
var state: State {
275311
toState(base.state)
276312
}
313+
@inlinable
314+
@inline(__always)
277315
func send(_ action: Action) -> Task<Void, Never>? {
278316
base.send(fromAction(action))
279317
}
318+
@inlinable
319+
@inline(__always)
280320
var canStoreCacheChildren: Bool {
281321
false
282322
}
323+
@inlinable
324+
@inline(__always)
283325
var didSet: CurrentValueRelay<Void> {
284326
base.didSet
285327
}
328+
@inlinable
329+
@inline(__always)
286330
var isInvalid: Bool {
287331
base.isInvalid
288332
}
333+
@inlinable
334+
@inline(__always)
289335
var effectCancellables: [UUID: AnyCancellable] {
290336
base.effectCancellables
291337
}

0 commit comments

Comments
 (0)