Skip to content

Commit 73250ad

Browse files
committed
de-gyb mirrors
1 parent 4867255 commit 73250ad

File tree

3 files changed

+261
-68
lines changed

3 files changed

+261
-68
lines changed

stdlib/public/core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ set(SWIFTLIB_ESSENTIAL
9494
Map.swift
9595
MemoryLayout.swift
9696
UnicodeScalar.swift # ORDER DEPENDENCY: Must precede Mirrors.swift
97+
Mirrors.swift
9798
Misc.swift
9899
MutableCollection.swift
99100
NativeDictionary.swift
@@ -191,7 +192,6 @@ set(SWIFTLIB_ESSENTIAL_GYB_SOURCES
191192
FloatingPointParsing.swift.gyb
192193
FloatingPointTypes.swift.gyb
193194
IntegerTypes.swift.gyb
194-
Mirrors.swift.gyb
195195
Runtime.swift.gyb
196196
UnavailableStringAPIs.swift.gyb
197197
UnsafeBufferPointer.swift.gyb

stdlib/public/core/Mirrors.swift

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,260 @@
1+
//===--- Mirrors.swift --- Common _Mirror implementations -----*- swift -*-===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
13+
extension Float: CustomReflectable {
14+
/// A mirror that reflects the `Float` instance.
15+
public var customMirror: Mirror {
16+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
17+
}
18+
}
19+
20+
extension Float: _CustomPlaygroundQuickLookable {
21+
/// A custom playground Quick Look for the `Float` instance.
22+
@available(*, deprecated, message: "Float.customPlaygroundQuickLook will be removed in a future Swift version")
23+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
24+
return .float(self)
25+
}
26+
}
27+
28+
extension Double: CustomReflectable {
29+
/// A mirror that reflects the `Double` instance.
30+
public var customMirror: Mirror {
31+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
32+
}
33+
}
34+
35+
extension Double: _CustomPlaygroundQuickLookable {
36+
/// A custom playground Quick Look for the `Double` instance.
37+
@available(*, deprecated, message: "Double.customPlaygroundQuickLook will be removed in a future Swift version")
38+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
39+
return .double(self)
40+
}
41+
}
42+
43+
extension Bool: CustomReflectable {
44+
/// A mirror that reflects the `Bool` instance.
45+
public var customMirror: Mirror {
46+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
47+
}
48+
}
49+
50+
extension Bool: _CustomPlaygroundQuickLookable {
51+
/// A custom playground Quick Look for the `Bool` instance.
52+
@available(*, deprecated, message: "Bool.customPlaygroundQuickLook will be removed in a future Swift version")
53+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
54+
return .bool(self)
55+
}
56+
}
57+
58+
extension String: CustomReflectable {
59+
/// A mirror that reflects the `String` instance.
60+
public var customMirror: Mirror {
61+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
62+
}
63+
}
64+
65+
extension String: _CustomPlaygroundQuickLookable {
66+
/// A custom playground Quick Look for the `String` instance.
67+
@available(*, deprecated, message: "String.customPlaygroundQuickLook will be removed in a future Swift version")
68+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
69+
return .text(self)
70+
}
71+
}
72+
73+
extension Character: CustomReflectable {
74+
/// A mirror that reflects the `Character` instance.
75+
public var customMirror: Mirror {
76+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
77+
}
78+
}
79+
80+
extension Character: _CustomPlaygroundQuickLookable {
81+
/// A custom playground Quick Look for the `Character` instance.
82+
@available(*, deprecated, message: "Character.customPlaygroundQuickLook will be removed in a future Swift version")
83+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
84+
return .text(String(self))
85+
}
86+
}
87+
88+
extension Unicode.Scalar: CustomReflectable {
89+
/// A mirror that reflects the `Unicode.Scalar` instance.
90+
public var customMirror: Mirror {
91+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
92+
}
93+
}
94+
95+
extension Unicode.Scalar: _CustomPlaygroundQuickLookable {
96+
/// A custom playground Quick Look for the `Unicode.Scalar` instance.
97+
@available(*, deprecated, message: "Unicode.Scalar.customPlaygroundQuickLook will be removed in a future Swift version")
98+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
99+
return .uInt(UInt64(self))
100+
}
101+
}
102+
103+
extension UInt8: CustomReflectable {
104+
/// A mirror that reflects the `UInt8` instance.
105+
public var customMirror: Mirror {
106+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
107+
}
108+
}
109+
110+
extension UInt8: _CustomPlaygroundQuickLookable {
111+
/// A custom playground Quick Look for the `UInt8` instance.
112+
@available(*, deprecated, message: "UInt8.customPlaygroundQuickLook will be removed in a future Swift version")
113+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
114+
return .uInt(UInt64(self))
115+
}
116+
}
117+
118+
extension Int8: CustomReflectable {
119+
/// A mirror that reflects the `Int8` instance.
120+
public var customMirror: Mirror {
121+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
122+
}
123+
}
124+
125+
extension Int8: _CustomPlaygroundQuickLookable {
126+
/// A custom playground Quick Look for the `Int8` instance.
127+
@available(*, deprecated, message: "Int8.customPlaygroundQuickLook will be removed in a future Swift version")
128+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
129+
return .int(Int64(self))
130+
}
131+
}
132+
133+
extension UInt16: CustomReflectable {
134+
/// A mirror that reflects the `UInt16` instance.
135+
public var customMirror: Mirror {
136+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
137+
}
138+
}
139+
140+
extension UInt16: _CustomPlaygroundQuickLookable {
141+
/// A custom playground Quick Look for the `UInt16` instance.
142+
@available(*, deprecated, message: "UInt16.customPlaygroundQuickLook will be removed in a future Swift version")
143+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
144+
return .uInt(UInt64(self))
145+
}
146+
}
147+
148+
extension Int16: CustomReflectable {
149+
/// A mirror that reflects the `Int16` instance.
150+
public var customMirror: Mirror {
151+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
152+
}
153+
}
154+
155+
extension Int16: _CustomPlaygroundQuickLookable {
156+
/// A custom playground Quick Look for the `Int16` instance.
157+
@available(*, deprecated, message: "Int16.customPlaygroundQuickLook will be removed in a future Swift version")
158+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
159+
return .int(Int64(self))
160+
}
161+
}
162+
163+
extension UInt32: CustomReflectable {
164+
/// A mirror that reflects the `UInt32` instance.
165+
public var customMirror: Mirror {
166+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
167+
}
168+
}
169+
170+
extension UInt32: _CustomPlaygroundQuickLookable {
171+
/// A custom playground Quick Look for the `UInt32` instance.
172+
@available(*, deprecated, message: "UInt32.customPlaygroundQuickLook will be removed in a future Swift version")
173+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
174+
return .uInt(UInt64(self))
175+
}
176+
}
177+
178+
extension Int32: CustomReflectable {
179+
/// A mirror that reflects the `Int32` instance.
180+
public var customMirror: Mirror {
181+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
182+
}
183+
}
184+
185+
extension Int32: _CustomPlaygroundQuickLookable {
186+
/// A custom playground Quick Look for the `Int32` instance.
187+
@available(*, deprecated, message: "Int32.customPlaygroundQuickLook will be removed in a future Swift version")
188+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
189+
return .int(Int64(self))
190+
}
191+
}
192+
193+
extension UInt64: CustomReflectable {
194+
/// A mirror that reflects the `UInt64` instance.
195+
public var customMirror: Mirror {
196+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
197+
}
198+
}
199+
200+
extension UInt64: _CustomPlaygroundQuickLookable {
201+
/// A custom playground Quick Look for the `UInt64` instance.
202+
@available(*, deprecated, message: "UInt64.customPlaygroundQuickLook will be removed in a future Swift version")
203+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
204+
return .uInt(UInt64(self))
205+
}
206+
}
207+
208+
extension Int64: CustomReflectable {
209+
/// A mirror that reflects the `Int64` instance.
210+
public var customMirror: Mirror {
211+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
212+
}
213+
}
214+
215+
extension Int64: _CustomPlaygroundQuickLookable {
216+
/// A custom playground Quick Look for the `Int64` instance.
217+
@available(*, deprecated, message: "Int64.customPlaygroundQuickLook will be removed in a future Swift version")
218+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
219+
return .int(Int64(self))
220+
}
221+
}
222+
223+
extension UInt: CustomReflectable {
224+
/// A mirror that reflects the `UInt` instance.
225+
public var customMirror: Mirror {
226+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
227+
}
228+
}
229+
230+
extension UInt: _CustomPlaygroundQuickLookable {
231+
/// A custom playground Quick Look for the `UInt` instance.
232+
@available(*, deprecated, message: "UInt.customPlaygroundQuickLook will be removed in a future Swift version")
233+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
234+
return .uInt(UInt64(self))
235+
}
236+
}
237+
238+
extension Int: CustomReflectable {
239+
/// A mirror that reflects the `Int` instance.
240+
public var customMirror: Mirror {
241+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
242+
}
243+
}
244+
245+
extension Int: _CustomPlaygroundQuickLookable {
246+
/// A custom playground Quick Look for the `Int` instance.
247+
@available(*, deprecated, message: "Int.customPlaygroundQuickLook will be removed in a future Swift version")
248+
public var customPlaygroundQuickLook: _PlaygroundQuickLook {
249+
return .int(Int64(self))
250+
}
251+
}
252+
253+
#if !(os(Windows) || os(Android)) && (arch(i386) || arch(x86_64))
254+
extension Float80: CustomReflectable {
255+
/// A mirror that reflects the Float80 instance.
256+
public var customMirror: Mirror {
257+
return Mirror(self, unlabeledChildren: EmptyCollection<Void>())
258+
}
259+
}
260+
#endif

stdlib/public/core/Mirrors.swift.gyb

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

0 commit comments

Comments
 (0)