Skip to content

Commit 7c2278b

Browse files
committed
debug
1 parent 8e62d65 commit 7c2278b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Sources/Dependencies/DependencyValues.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,51 +559,67 @@ public final class CachedValues: @unchecked Sendable {
559559
}
560560
#endif
561561

562+
print(#fileID, #line)
562563
guard let base = cached[cacheKey]?.base, let value = base as? Key.Value
563564
else {
565+
print(#fileID, #line)
564566
let value: Key.Value?
565567
switch context {
566568
case .live:
569+
print(#fileID, #line)
567570
value = (key as? any DependencyKey.Type)?.liveValue as? Key.Value
568571
case .preview:
572+
print(#fileID, #line)
569573
if Thread.isPreviewAppEntryPoint {
570574
return Key.previewValue
571575
}
572576
if !CachedValues.isAccessingCachedDependencies {
577+
print(#fileID, #line)
573578
value = CachedValues.$isAccessingCachedDependencies.withValue(true) {
574579
#if canImport(SwiftUI) && compiler(>=6)
580+
print(#fileID, #line)
575581
return previewValues[key]
576582
#else
583+
print(#fileID, #line)
577584
return Key.previewValue
578585
#endif
579586
}
580587
} else {
588+
print(#fileID, #line)
581589
value = Key.previewValue
582590
}
583591
case .test:
584592
#if compiler(<6.1)
593+
print(#fileID, #line)
585594
if !CachedValues.isAccessingCachedDependencies,
586595
case let .swiftTesting(.some(testing)) = TestContext.current,
587596
let testValues = testValuesByTestID.withValue({ $0[testing.test.id.rawValue] })
588597
{
598+
print(#fileID, #line)
589599
value = CachedValues.$isAccessingCachedDependencies.withValue(true) {
590600
testValues[key]
591601
}
592602
} else {
603+
print(#fileID, #line)
593604
value = Key.testValue
594605
}
595606
#else
607+
print(#fileID, #line)
596608
value = Key.testValue
597609
#endif
598610
}
599611

612+
print(#fileID, #line)
600613
let cacheableValue = value ?? Key.testValue
614+
print(#fileID, #line)
601615
cached[cacheKey] = CachedValue(
602616
base: cacheableValue,
603617
preparationID: DependencyValues.preparationID
604618
)
619+
print(#fileID, #line)
605620
return cacheableValue
606621
}
622+
print(#fileID, #line)
607623

608624
return value
609625
}

0 commit comments

Comments
 (0)