Skip to content

Commit 043a9fd

Browse files
committed
[embedded] Move embedded ifdefs around in ObjectIdentifier.swift to avoid detaching doccomments from their decls
1 parent 3646c32 commit 043a9fd

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

stdlib/public/core/ObjectIdentifier.swift

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if !$Embedded
14+
1315
/// A unique identifier for a class instance or metatype.
1416
///
1517
/// This unique identifier is only valid for comparisons during the lifetime
@@ -50,33 +52,40 @@ public struct ObjectIdentifier: Sendable {
5052
/// // Prints "false"
5153
///
5254
/// - Parameter x: An instance of a class.
53-
#if $Embedded
54-
@inlinable // trivial-implementation
55-
public init<Object: AnyObject>(_ x: Object) {
56-
self._value = Builtin.bridgeToRawPointer(x)
57-
}
58-
#else
5955
@inlinable // trivial-implementation
6056
public init(_ x: AnyObject) {
6157
self._value = Builtin.bridgeToRawPointer(x)
6258
}
63-
#endif
59+
6460
/// Creates an instance that uniquely identifies the given metatype.
6561
///
6662
/// - Parameter: A metatype.
67-
#if $Embedded
6863
@inlinable // trivial-implementation
69-
public init<Object>(_ x: Object.Type) {
64+
public init(_ x: Any.Type) {
7065
self._value = unsafeBitCast(x, to: Builtin.RawPointer.self)
7166
}
67+
}
68+
7269
#else
70+
71+
@frozen // trivial-implementation
72+
public struct ObjectIdentifier: Sendable {
73+
@usableFromInline // trivial-implementation
74+
internal let _value: Builtin.RawPointer
75+
7376
@inlinable // trivial-implementation
74-
public init(_ x: Any.Type) {
77+
public init<Object: AnyObject>(_ x: Object) {
78+
self._value = Builtin.bridgeToRawPointer(x)
79+
}
80+
81+
@inlinable // trivial-implementation
82+
public init<Object>(_ x: Object.Type) {
7583
self._value = unsafeBitCast(x, to: Builtin.RawPointer.self)
7684
}
77-
#endif
7885
}
7986

87+
#endif
88+
8089
@_unavailableInEmbedded
8190
extension ObjectIdentifier: CustomDebugStringConvertible {
8291
/// A textual representation of the identifier, suitable for debugging.

0 commit comments

Comments
 (0)