Skip to content

Commit 0dbd39a

Browse files
Fix build for embedded platforms around JSBigIntExtended existential
1 parent 459d1e9 commit 0dbd39a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/JavaScriptKit/ConstructibleFromJSValue.swift

+8-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extension SignedInteger where Self: ConstructibleFromJSValue {
4040
/// If the value is too large to fit in the `Self` type, `nil` is returned.
4141
///
4242
/// - Parameter bigInt: The `JSBigIntExtended` to decode
43-
public init?(exactly bigInt: JSBigIntExtended) {
43+
public init?(exactly bigInt: some JSBigIntExtended) {
4444
self.init(exactly: bigInt.int64Value)
4545
}
4646

@@ -49,7 +49,7 @@ extension SignedInteger where Self: ConstructibleFromJSValue {
4949
/// Crash if the value is too large to fit in the `Self` type.
5050
///
5151
/// - Parameter bigInt: The `JSBigIntExtended` to decode
52-
public init(_ bigInt: JSBigIntExtended) {
52+
public init(_ bigInt: some JSBigIntExtended) {
5353
self.init(bigInt.int64Value)
5454
}
5555

@@ -68,9 +68,11 @@ extension SignedInteger where Self: ConstructibleFromJSValue {
6868
if let number = value.number {
6969
return Self(exactly: number.rounded(.towardZero))
7070
}
71+
#if !hasFeature(Embedded)
7172
if let bigInt = value.bigInt as? JSBigIntExtended {
7273
return Self(exactly: bigInt)
7374
}
75+
#endif
7476
return nil
7577
}
7678
}
@@ -87,7 +89,7 @@ extension UnsignedInteger where Self: ConstructibleFromJSValue {
8789
/// Returns `nil` if the value is negative or too large to fit in the `Self` type.
8890
///
8991
/// - Parameter bigInt: The `JSBigIntExtended` to decode
90-
public init?(exactly bigInt: JSBigIntExtended) {
92+
public init?(exactly bigInt: some JSBigIntExtended) {
9193
self.init(exactly: bigInt.uInt64Value)
9294
}
9395

@@ -96,7 +98,7 @@ extension UnsignedInteger where Self: ConstructibleFromJSValue {
9698
/// Crash if the value is negative or too large to fit in the `Self` type.
9799
///
98100
/// - Parameter bigInt: The `JSBigIntExtended` to decode
99-
public init(_ bigInt: JSBigIntExtended) {
101+
public init(_ bigInt: some JSBigIntExtended) {
100102
self.init(bigInt.uInt64Value)
101103
}
102104

@@ -114,9 +116,11 @@ extension UnsignedInteger where Self: ConstructibleFromJSValue {
114116
if let number = value.number {
115117
return Self(exactly: number.rounded(.towardZero))
116118
}
119+
#if !hasFeature(Embedded)
117120
if let bigInt = value.bigInt as? JSBigIntExtended {
118121
return Self(exactly: bigInt)
119122
}
123+
#endif
120124
return nil
121125
}
122126
}

0 commit comments

Comments
 (0)