@@ -26,42 +26,42 @@ extension CachingQuery {
26
26
// SwiftPM has to be built with Swift 5.8 on CI and also needs to support CMake for bootstrapping on Windows.
27
27
// This means we can't implement persistable hashing with macros (unavailable in Swift 5.8 and additional effort to
28
28
// set up with CMake when Swift 5.9 is available for all CI jobs) and have to stick to `Encodable` for now.
29
- final class HashEncoder < Hash: HashFunction > : Encoder {
29
+ package final class HashEncoder < Hash: HashFunction > : Encoder {
30
30
enum Error : Swift . Error {
31
31
case noCacheKeyConformance( Encodable . Type )
32
32
}
33
33
34
- var codingPath : [ any CodingKey ]
34
+ package var codingPath : [ any CodingKey ]
35
35
36
- var userInfo : [ CodingUserInfoKey : Any ]
36
+ package var userInfo : [ CodingUserInfoKey : Any ]
37
37
38
- func container< Key> ( keyedBy type: Key . Type ) -> KeyedEncodingContainer < Key > where Key: CodingKey {
38
+ package func container< Key> ( keyedBy type: Key . Type ) -> KeyedEncodingContainer < Key > where Key: CodingKey {
39
39
. init( KeyedContainer ( encoder: self ) )
40
40
}
41
41
42
- func unkeyedContainer( ) -> any UnkeyedEncodingContainer {
42
+ package func unkeyedContainer( ) -> any UnkeyedEncodingContainer {
43
43
self
44
44
}
45
45
46
- func singleValueContainer( ) -> any SingleValueEncodingContainer {
46
+ package func singleValueContainer( ) -> any SingleValueEncodingContainer {
47
47
self
48
48
}
49
49
50
- init ( ) {
50
+ package init ( ) {
51
51
self . hashFunction = Hash ( )
52
52
self . codingPath = [ ]
53
53
self . userInfo = [ : ]
54
54
}
55
55
56
56
fileprivate var hashFunction = Hash ( )
57
57
58
- func finalize( ) -> Hash . Digest {
58
+ package func finalize( ) -> Hash . Digest {
59
59
self . hashFunction. finalize ( )
60
60
}
61
61
}
62
62
63
63
extension HashEncoder : SingleValueEncodingContainer {
64
- func encodeNil( ) throws {
64
+ package func encodeNil( ) throws {
65
65
// FIXME: this doesn't encode the name of the underlying optional type,
66
66
// but `Encoder` protocol is limited and can't provide this for us.
67
67
var str = " nil "
@@ -70,63 +70,63 @@ extension HashEncoder: SingleValueEncodingContainer {
70
70
}
71
71
}
72
72
73
- func encode( _ value: Bool ) throws {
73
+ package func encode( _ value: Bool ) throws {
74
74
value. hash ( with: & self . hashFunction)
75
75
}
76
76
77
- func encode( _ value: String ) throws {
77
+ package func encode( _ value: String ) throws {
78
78
value. hash ( with: & self . hashFunction)
79
79
}
80
80
81
- func encode( _ value: Double ) throws {
81
+ package func encode( _ value: Double ) throws {
82
82
value. hash ( with: & self . hashFunction)
83
83
}
84
84
85
- func encode( _ value: Float ) throws {
85
+ package func encode( _ value: Float ) throws {
86
86
value. hash ( with: & self . hashFunction)
87
87
}
88
88
89
- func encode( _ value: Int ) throws {
89
+ package func encode( _ value: Int ) throws {
90
90
value. hash ( with: & self . hashFunction)
91
91
}
92
92
93
- func encode( _ value: Int8 ) throws {
93
+ package func encode( _ value: Int8 ) throws {
94
94
value. hash ( with: & self . hashFunction)
95
95
}
96
96
97
- func encode( _ value: Int16 ) throws {
97
+ package func encode( _ value: Int16 ) throws {
98
98
value. hash ( with: & self . hashFunction)
99
99
}
100
100
101
- func encode( _ value: Int32 ) throws {
101
+ package func encode( _ value: Int32 ) throws {
102
102
value. hash ( with: & self . hashFunction)
103
103
}
104
104
105
- func encode( _ value: Int64 ) throws {
105
+ package func encode( _ value: Int64 ) throws {
106
106
value. hash ( with: & self . hashFunction)
107
107
}
108
108
109
- func encode( _ value: UInt ) throws {
109
+ package func encode( _ value: UInt ) throws {
110
110
value. hash ( with: & self . hashFunction)
111
111
}
112
112
113
- func encode( _ value: UInt8 ) throws {
113
+ package func encode( _ value: UInt8 ) throws {
114
114
value. hash ( with: & self . hashFunction)
115
115
}
116
116
117
- func encode( _ value: UInt16 ) throws {
117
+ package func encode( _ value: UInt16 ) throws {
118
118
value. hash ( with: & self . hashFunction)
119
119
}
120
120
121
- func encode( _ value: UInt32 ) throws {
121
+ package func encode( _ value: UInt32 ) throws {
122
122
value. hash ( with: & self . hashFunction)
123
123
}
124
124
125
- func encode( _ value: UInt64 ) throws {
125
+ package func encode( _ value: UInt64 ) throws {
126
126
value. hash ( with: & self . hashFunction)
127
127
}
128
128
129
- func encode< T> ( _ value: T ) throws where T: Encodable {
129
+ package func encode< T> ( _ value: T ) throws where T: Encodable {
130
130
if let leaf = value as? LeafCacheKey {
131
131
leaf. hash ( with: & self . hashFunction)
132
132
return
@@ -142,20 +142,20 @@ extension HashEncoder: SingleValueEncodingContainer {
142
142
}
143
143
144
144
extension HashEncoder : UnkeyedEncodingContainer {
145
- var count : Int {
145
+ package var count : Int {
146
146
0
147
147
}
148
148
149
- func nestedContainer< NestedKey> ( keyedBy keyType: NestedKey . Type ) -> KeyedEncodingContainer < NestedKey >
149
+ package func nestedContainer< NestedKey> ( keyedBy keyType: NestedKey . Type ) -> KeyedEncodingContainer < NestedKey >
150
150
where NestedKey: CodingKey {
151
151
KeyedEncodingContainer ( KeyedContainer ( encoder: self ) )
152
152
}
153
153
154
- func nestedUnkeyedContainer( ) -> any UnkeyedEncodingContainer {
154
+ package func nestedUnkeyedContainer( ) -> any UnkeyedEncodingContainer {
155
155
self
156
156
}
157
157
158
- func superEncoder( ) -> any Encoder {
158
+ package func superEncoder( ) -> any Encoder {
159
159
fatalError ( )
160
160
}
161
161
}
0 commit comments