|
3 | 3 | // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
|
5 | 5 | @JS() |
6 | | -library native_version_javascript; |
| 6 | +library; |
| 7 | + |
| 8 | +import 'dart:js_interop'; |
7 | 9 |
|
8 | | -// ignore: deprecated_member_use |
9 | | -import 'package:js/js.dart'; |
10 | 10 | import 'native_version.dart'; |
11 | 11 |
|
12 | 12 | const NativeBigIntMethods nativeBigInt = _Methods(); |
13 | 13 |
|
14 | 14 | @JS('eval') |
15 | | -external Object _eval(String s); |
| 15 | +external JSAny? _eval(String s); |
16 | 16 |
|
17 | 17 | @JS('bigint_parse') |
18 | | -external Object _parse(String s); |
| 18 | +external JSBigInt _parse(String s); |
19 | 19 |
|
20 | 20 | @JS('bigint_toString') |
21 | | -external String _toStringMethod(Object o); |
| 21 | +external String _toStringMethod(JSBigInt o); |
22 | 22 |
|
23 | 23 | @JS('bigint_bitLength') |
24 | | -external int _bitLength(Object o); |
| 24 | +external int _bitLength(JSBigInt o); |
25 | 25 |
|
26 | 26 | @JS('bigint_isEven') |
27 | | -external bool _isEven(Object o); |
| 27 | +external bool _isEven(JSBigInt o); |
28 | 28 |
|
29 | 29 | @JS('bigint_add') |
30 | | -external Object _add(Object left, Object right); |
| 30 | +external JSBigInt _add(JSBigInt left, JSBigInt right); |
31 | 31 |
|
32 | 32 | @JS('bigint_shiftLeft') |
33 | | -external Object _shiftLeft(Object o, Object i); |
| 33 | +external JSBigInt _shiftLeft(JSBigInt o, JSBigInt i); |
34 | 34 |
|
35 | 35 | @JS('bigint_shiftRight') |
36 | | -external Object _shiftRight(Object o, Object i); |
| 36 | +external JSBigInt _shiftRight(JSBigInt o, JSBigInt i); |
37 | 37 |
|
38 | 38 | @JS('bigint_subtract') |
39 | | -external Object _subtract(Object left, Object right); |
| 39 | +external JSBigInt _subtract(JSBigInt left, JSBigInt right); |
40 | 40 |
|
41 | 41 | @JS('bigint_fromInt') |
42 | | -external Object _fromInt(int i); |
| 42 | +external JSBigInt _fromInt(int i); |
43 | 43 |
|
44 | | -class _Methods implements NativeBigIntMethods { |
| 44 | +class _Methods implements NativeBigIntMethods<JSBigInt> { |
45 | 45 | static bool _initialized = false; |
46 | 46 | static bool _enabled = false; |
47 | 47 |
|
@@ -71,37 +71,39 @@ class _Methods implements NativeBigIntMethods { |
71 | 71 | } |
72 | 72 |
|
73 | 73 | @override |
74 | | - Object parse(String string) => _parse(string); |
| 74 | + JSBigInt parse(String string) => _parse(string); |
75 | 75 |
|
76 | 76 | @override |
77 | | - String toStringMethod(Object value) => _toStringMethod(value); |
| 77 | + String toStringMethod(JSBigInt value) => _toStringMethod(value); |
78 | 78 |
|
79 | 79 | @override |
80 | | - Object fromInt(int i) => _fromInt(i); |
| 80 | + JSBigInt fromInt(int i) => _fromInt(i); |
81 | 81 |
|
82 | 82 | @override |
83 | | - Object get one => _one; |
| 83 | + JSBigInt get one => _one; |
84 | 84 |
|
85 | 85 | @override |
86 | | - Object get eight => _eight; |
| 86 | + JSBigInt get eight => _eight; |
87 | 87 |
|
88 | 88 | @override |
89 | | - int bitLength(Object value) => _bitLength(value); |
| 89 | + int bitLength(JSBigInt value) => _bitLength(value); |
90 | 90 |
|
91 | 91 | @override |
92 | | - bool isEven(Object value) => _isEven(value); |
| 92 | + bool isEven(JSBigInt value) => _isEven(value); |
93 | 93 |
|
94 | 94 | @override |
95 | | - Object add(Object left, Object right) => _add(left, right); |
| 95 | + JSBigInt add(JSBigInt left, JSBigInt right) => _add(left, right); |
96 | 96 |
|
97 | 97 | @override |
98 | | - Object shiftLeft(Object value, Object count) => _shiftLeft(value, count); |
| 98 | + JSBigInt shiftLeft(JSBigInt value, JSBigInt count) => |
| 99 | + _shiftLeft(value, count); |
99 | 100 |
|
100 | 101 | @override |
101 | | - Object shiftRight(Object value, Object count) => _shiftRight(value, count); |
| 102 | + JSBigInt shiftRight(JSBigInt value, JSBigInt count) => |
| 103 | + _shiftRight(value, count); |
102 | 104 |
|
103 | 105 | @override |
104 | | - Object subtract(Object left, Object right) => _subtract(left, right); |
| 106 | + JSBigInt subtract(JSBigInt left, JSBigInt right) => _subtract(left, right); |
105 | 107 | } |
106 | 108 |
|
107 | 109 | void _setup() { |
|
0 commit comments