@@ -150,9 +150,7 @@ internal final class InternalDefaultLiveMap: Sendable {
150150 return mutex. withLock {
151151 // RTLM10d: Returns the number of non-tombstoned entries (per RTLM14) in the internal data map
152152 mutableState. data. values. count { entry in
153- // RTLM14a: The method returns true if ObjectsMapEntry.tombstone is true
154- // RTLM14b: Otherwise, it returns false
155- entry. tombstone != true
153+ !Self. isEntryTombstoned ( entry)
156154 }
157155 }
158156 }
@@ -173,7 +171,7 @@ internal final class InternalDefaultLiveMap: Sendable {
173171 // RTLM11d1: Pairs with tombstoned entries (per RTLM14) are not returned
174172 var result : [ ( key: String , value: InternalLiveMapValue ) ] = [ ]
175173
176- for (key, entry) in mutableState. data {
174+ for (key, entry) in mutableState. data where !Self . isEntryTombstoned ( entry ) {
177175 // Convert entry to LiveMapValue using the same logic as get(key:)
178176 if let value = convertEntryToLiveMapValue ( entry, delegate: delegate) {
179177 result. append ( ( key: key, value: value) )
@@ -778,11 +776,16 @@ internal final class InternalDefaultLiveMap: Sendable {
778776
779777 // MARK: - Helper Methods
780778
779+ /// Returns whether a map entry should be considered tombstoned, per the check described in RTLM14.
780+ private static func isEntryTombstoned( _ entry: InternalObjectsMapEntry ) -> Bool {
781+ // RTLM14a, RTLM14b
782+ entry. tombstone
783+ }
784+
781785 /// Converts an InternalObjectsMapEntry to LiveMapValue using the same logic as get(key:)
782786 /// This is used by entries to ensure consistent value conversion
783787 private func convertEntryToLiveMapValue( _ entry: InternalObjectsMapEntry , delegate: LiveMapObjectPoolDelegate ) -> InternalLiveMapValue ? {
784788 // RTLM5d2a: If ObjectsMapEntry.tombstone is true, return undefined/null
785- // This is also equivalent to the RTLM14 check
786789 if entry. tombstone == true {
787790 return nil
788791 }
0 commit comments