@@ -6,7 +6,7 @@ import _CJavaScriptKit
6
6
7
7
public protocol TypedArrayElement : JSValueConvertible , JSValueConstructible {
8
8
static var typedArrayKind : JavaScriptTypedArrayKind { get }
9
- static var typedArrayClass : JSFunctionRef { get }
9
+ static var typedArrayClass : JSFunction { get }
10
10
}
11
11
12
12
public class JSTypedArray < Element> : JSValueConvertible , ExpressibleByArrayLiteral where Element: TypedArrayElement {
@@ -23,7 +23,7 @@ public class JSTypedArray<Element>: JSValueConvertible, ExpressibleByArrayLitera
23
23
setJSValue ( this: ref, index: Int32 ( index) , value: newValue. jsValue ( ) )
24
24
}
25
25
}
26
-
26
+
27
27
// This private initializer assumes that the passed object is TypedArray
28
28
private init ( unsafe object: JSObject ) {
29
29
self . ref = object
@@ -70,16 +70,16 @@ func valueForBitWidth<T>(typeName: String, bitWidth: Int, when32: T) -> T {
70
70
}
71
71
72
72
extension Int : TypedArrayElement {
73
- public static var typedArrayClass : JSFunctionRef {
74
- valueForBitWidth ( typeName: " Int " , bitWidth: Int . bitWidth, when32: JSObjectRef . global. Int32Array) . function!
73
+ public static var typedArrayClass : JSFunction {
74
+ valueForBitWidth ( typeName: " Int " , bitWidth: Int . bitWidth, when32: JSObject . global. Int32Array) . function!
75
75
}
76
76
public static var typedArrayKind : JavaScriptTypedArrayKind {
77
77
valueForBitWidth ( typeName: " Int " , bitWidth: Int . bitWidth, when32: . int32)
78
78
}
79
79
}
80
80
extension UInt : TypedArrayElement {
81
- public static var typedArrayClass : JSFunctionRef {
82
- valueForBitWidth ( typeName: " UInt " , bitWidth: Int . bitWidth, when32: JSObjectRef . global. Uint32Array) . function!
81
+ public static var typedArrayClass : JSFunction {
82
+ valueForBitWidth ( typeName: " UInt " , bitWidth: Int . bitWidth, when32: JSObject . global. Uint32Array) . function!
83
83
}
84
84
public static var typedArrayKind : JavaScriptTypedArrayKind {
85
85
valueForBitWidth ( typeName: " UInt " , bitWidth: UInt . bitWidth, when32: . uint32)
@@ -89,30 +89,30 @@ extension UInt: TypedArrayElement {
89
89
// MARK: - Concrete TypedArray classes
90
90
91
91
extension Int8 : TypedArrayElement {
92
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Int8Array. function! }
92
+ public static var typedArrayClass : JSFunction { JSObject . global. Int8Array. function! }
93
93
public static var typedArrayKind : JavaScriptTypedArrayKind { . int8 }
94
94
}
95
95
extension UInt8 : TypedArrayElement {
96
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Uint8Array. function! }
96
+ public static var typedArrayClass : JSFunction { JSObject . global. Uint8Array. function! }
97
97
public static var typedArrayKind : JavaScriptTypedArrayKind { . uint8 }
98
98
}
99
99
// TODO: Support Uint8ClampedArray?
100
100
101
101
extension Int16 : TypedArrayElement {
102
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Int16Array. function! }
102
+ public static var typedArrayClass : JSFunction { JSObject . global. Int16Array. function! }
103
103
public static var typedArrayKind : JavaScriptTypedArrayKind { . int16 }
104
104
}
105
105
extension UInt16 : TypedArrayElement {
106
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Uint16Array. function! }
106
+ public static var typedArrayClass : JSFunction { JSObject . global. Uint16Array. function! }
107
107
public static var typedArrayKind : JavaScriptTypedArrayKind { . uint16 }
108
108
}
109
109
110
110
extension Int32 : TypedArrayElement {
111
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Int32Array. function! }
111
+ public static var typedArrayClass : JSFunction { JSObject . global. Int32Array. function! }
112
112
public static var typedArrayKind : JavaScriptTypedArrayKind { . int32 }
113
113
}
114
114
extension UInt32 : TypedArrayElement {
115
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Uint32Array. function! }
115
+ public static var typedArrayClass : JSFunction { JSObject . global. Uint32Array. function! }
116
116
public static var typedArrayKind : JavaScriptTypedArrayKind { . uint32 }
117
117
}
118
118
@@ -127,10 +127,10 @@ extension UInt32: TypedArrayElement {
127
127
//}
128
128
129
129
extension Float32 : TypedArrayElement {
130
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Float32Array. function! }
130
+ public static var typedArrayClass : JSFunction { JSObject . global. Float32Array. function! }
131
131
public static var typedArrayKind : JavaScriptTypedArrayKind { . float32 }
132
132
}
133
133
extension Float64 : TypedArrayElement {
134
- public static var typedArrayClass : JSFunctionRef { JSObjectRef . global. Float64Array. function! }
134
+ public static var typedArrayClass : JSFunction { JSObject . global. Float64Array. function! }
135
135
public static var typedArrayKind : JavaScriptTypedArrayKind { . float64 }
136
136
}
0 commit comments