Skip to content

Commit d4f9800

Browse files
Revert "Refactor Mirror to reduce metadata allocation (#32041) (#32957)"
This reverts commit a7542a5.
1 parent 2556f22 commit d4f9800

8 files changed

+91
-300
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ set(SWIFTLIB_ESSENTIAL
6060
DictionaryVariant.swift
6161
DropWhile.swift
6262
Dump.swift
63-
EitherSequence.swift
6463
EmptyCollection.swift
6564
Equatable.swift
6665
ErrorType.swift

stdlib/public/core/DebuggerSupport.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public enum _DebuggerSupport {
110110

111111
private static func ivarCount(mirror: Mirror) -> Int {
112112
let ivars = mirror.superclassMirror.map(ivarCount) ?? 0
113-
return ivars + mirror._children.count
113+
return ivars + mirror.children.count
114114
}
115115

116116
private static func shouldExpand(
@@ -119,7 +119,7 @@ public enum _DebuggerSupport {
119119
isRoot: Bool
120120
) -> Bool {
121121
if isRoot || collectionStatus.isCollection { return true }
122-
if !mirror._children.isEmpty { return true }
122+
if !mirror.children.isEmpty { return true }
123123
if mirror.displayStyle == .`class` { return true }
124124
if let sc = mirror.superclassMirror { return ivarCount(mirror: sc) > 0 }
125125
return true
@@ -154,7 +154,7 @@ public enum _DebuggerSupport {
154154
// anyway, so there's that...
155155
let willExpand = mirror.displayStyle != .`class` || value is CustomReflectable?
156156

157-
let count = mirror._children.count
157+
let count = mirror.children.count
158158
let bullet = isRoot && (count == 0 || !willExpand) ? ""
159159
: count == 0 ? "- "
160160
: maxDepth <= 0 ? "" : ""
@@ -202,7 +202,7 @@ public enum _DebuggerSupport {
202202
target: &target)
203203
}
204204

205-
for (optionalName,child) in mirror._children {
205+
for (optionalName,child) in mirror.children {
206206
let childName = optionalName ?? "\(printedElements)"
207207
if maxItemCounter <= 0 {
208208
print(String(repeating: " ", count: indent+4), terminator: "", to: &target)

stdlib/public/core/Dump.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ internal func _dump_unlocked<TargetStream: TextOutputStream>(
9999
for _ in 0..<indent { target.write(" ") }
100100

101101
let mirror = Mirror(reflecting: value)
102-
let count = mirror._children.count
102+
let count = mirror.children.count
103103
let bullet = count == 0 ? "-"
104104
: maxDepth <= 0 ? "" : ""
105105
target.write(bullet)
@@ -149,7 +149,7 @@ internal func _dump_unlocked<TargetStream: TextOutputStream>(
149149
visitedItems: &visitedItems)
150150
}
151151

152-
var currentIndex = mirror._children.startIndex
152+
var currentIndex = mirror.children.startIndex
153153
for i in 0..<count {
154154
if maxItemCounter <= 0 {
155155
for _ in 0..<(indent+4) {
@@ -167,8 +167,8 @@ internal func _dump_unlocked<TargetStream: TextOutputStream>(
167167
return
168168
}
169169

170-
let (name, child) = mirror._children[currentIndex]
171-
mirror._children.formIndex(after: &currentIndex)
170+
let (name, child) = mirror.children[currentIndex]
171+
mirror.children.formIndex(after: &currentIndex)
172172
_dump_unlocked(
173173
child,
174174
to: &target,
@@ -196,7 +196,7 @@ internal func _dumpSuperclass_unlocked<TargetStream: TextOutputStream>(
196196

197197
for _ in 0..<indent { target.write(" ") }
198198

199-
let count = mirror._children.count
199+
let count = mirror.children.count
200200
let bullet = count == 0 ? "-"
201201
: maxDepth <= 0 ? "" : ""
202202
target.write(bullet)
@@ -216,7 +216,7 @@ internal func _dumpSuperclass_unlocked<TargetStream: TextOutputStream>(
216216
visitedItems: &visitedItems)
217217
}
218218

219-
var currentIndex = mirror._children.startIndex
219+
var currentIndex = mirror.children.startIndex
220220
for i in 0..<count {
221221
if maxItemCounter <= 0 {
222222
for _ in 0..<(indent+4) {
@@ -234,8 +234,8 @@ internal func _dumpSuperclass_unlocked<TargetStream: TextOutputStream>(
234234
return
235235
}
236236

237-
let (name, child) = mirror._children[currentIndex]
238-
mirror._children.formIndex(after: &currentIndex)
237+
let (name, child) = mirror.children[currentIndex]
238+
mirror.children.formIndex(after: &currentIndex)
239239
_dump_unlocked(
240240
child,
241241
to: &target,

stdlib/public/core/EitherSequence.swift

Lines changed: 0 additions & 197 deletions
This file was deleted.

stdlib/public/core/GroupInfo.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
"RandomAccessCollection.swift",
6565
"MutableCollection.swift",
6666
"CollectionAlgorithms.swift",
67-
"EitherSequence.swift",
6867
"EmptyCollection.swift",
6968
"Stride.swift",
7069
"Repeat.swift",

0 commit comments

Comments
 (0)