Skip to content

Add support for BigInts and BigInt-based TypedArrays #184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 35 commits into from
Apr 22, 2022
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fa93b91
Initial BigInt support
j-f1 Apr 9, 2022
3ca1539
Switch to const enums
j-f1 Apr 9, 2022
bf3bac3
Add JSBigInt/clamped method, fix overload
j-f1 Apr 9, 2022
8c02c79
Convert BigInts into Swift ints automatically
j-f1 Apr 9, 2022
814774b
Add support for JAVASCRIPTKIT_WITHOUT_BIGINTS
j-f1 Apr 9, 2022
0bcb359
Allow Int64/UInt64-based arrays
j-f1 Apr 9, 2022
d1543fc
Don’t use BigInt literal for backwards compat
j-f1 Apr 9, 2022
f8838eb
bump lib version
j-f1 Apr 9, 2022
26b51c7
long long?
j-f1 Apr 9, 2022
4dd4aae
document JAVASCRIPTKIT_WITHOUT_BIGINTS flag
j-f1 Apr 9, 2022
cd3c076
check compatibility workflow builds all variants
j-f1 Apr 9, 2022
76303b9
Increase error stack trace limit
j-f1 Apr 9, 2022
c356aba
Use correct type for setTimeout in JavaScriptEventLoop
j-f1 Apr 9, 2022
6f150ad
Add symbol support to runtime’s JSValue.decode
j-f1 Apr 9, 2022
6257d35
remove JavaScriptValueKindInvalid since neither side produces it
j-f1 Apr 9, 2022
203844f
use assertNever to ensure runtime switch statements are kept up to date
j-f1 Apr 9, 2022
9d066f9
BigInt tests
j-f1 Apr 9, 2022
1fdcd26
Revert changes to README
j-f1 Apr 10, 2022
14541b8
consistent whitespace (by semantic grouping) in index.ts
j-f1 Apr 10, 2022
dcd38c7
Rename: type→kind
j-f1 Apr 10, 2022
63f33d0
drop implicit return
j-f1 Apr 10, 2022
30a3e66
assert Int/UInt types are 32-bit for now
j-f1 Apr 10, 2022
68cb689
Require BigInts for ConvertibleToJSValue conformance on Int64/UInt64
j-f1 Apr 10, 2022
01ae32d
run Prettier on primary-tests.js
j-f1 Apr 10, 2022
a44de1a
move stackTraceLimit change to non-benchmark tests only
j-f1 Apr 10, 2022
6517b7e
remove JAVASCRIPTKIT_WITHOUT_BIGINTS
j-f1 Apr 16, 2022
c54bd10
SPI for JSObject_id
j-f1 Apr 16, 2022
7af5917
Move i64 stuff to a separate module
j-f1 Apr 16, 2022
b7a6a7d
fix Signed/UnsignedInteger ConstructibleFromJSValue
j-f1 Apr 16, 2022
b83611f
fix tests?
j-f1 Apr 16, 2022
4ca7705
Address review comments
j-f1 Apr 16, 2022
35dd9f7
Simplify JSValue: CustomStringConvertible conformance
j-f1 Apr 16, 2022
0ec8fc3
rename to JavaScriptBigIntSupport
j-f1 Apr 22, 2022
7960198
Formatting tweak
j-f1 Apr 22, 2022
5cff142
fix typo
j-f1 Apr 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow Int64/UInt64-based arrays
  • Loading branch information
j-f1 committed Apr 10, 2022
commit 0bcb359c4791961272735f86ce2958c8b251316c
16 changes: 8 additions & 8 deletions Sources/JavaScriptKit/BasicObjects/JSTypedArray.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ extension UInt32: TypedArrayElement {
public static var typedArrayClass = JSObject.global.Uint32Array.function!
}

// FIXME: Support passing BigInts across the bridge
// See https://github.com/swiftwasm/JavaScriptKit/issues/56
//extension Int64: TypedArrayElement {
// public static var typedArrayClass = JSObject.global.BigInt64Array.function!
//}
//extension UInt64: TypedArrayElement {
// public static var typedArrayClass = JSObject.global.BigUint64Array.function!
//}
#if !JAVASCRIPTKIT_WITHOUT_BIGINTS
extension Int64: TypedArrayElement {
public static var typedArrayClass = JSObject.global.BigInt64Array.function!
}
extension UInt64: TypedArrayElement {
public static var typedArrayClass = JSObject.global.BigUint64Array.function!
}
#endif

extension Float32: TypedArrayElement {
public static var typedArrayClass = JSObject.global.Float32Array.function!
Expand Down