Skip to content

Commit 9fefb52

Browse files
authored
Make Int64 default constructor non-const in native mode (#916)
To be compatible with the emulated `Int64` class and backwards compatible, make the native `Int64` class constructor non-const. Add a new private const constructor for the static const fields. Not updating the changelog as the `Int64` improvements are already in teh changelog and we haven't released a version with the previous changes.
1 parent f00841d commit 9fefb52

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

pkgs/fixnum/lib/src/int64_native.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@ class Int64 implements IntX {
1515

1616
/// The maximum positive value attainable by an [Int64], namely
1717
/// 9,223,372,036,854,775,807.
18-
static const Int64 MAX_VALUE = Int64(9223372036854775807);
18+
static const Int64 MAX_VALUE = Int64._(9223372036854775807);
1919

2020
/// The minimum positive value attainable by an [Int64], namely
2121
/// -9,223,372,036,854,775,808.
22-
static const Int64 MIN_VALUE = Int64(-9223372036854775808);
22+
static const Int64 MIN_VALUE = Int64._(-9223372036854775808);
2323

2424
/// An [Int64] constant equal to 0.
25-
static const Int64 ZERO = Int64(0);
25+
static const Int64 ZERO = Int64._(0);
2626

2727
/// An [Int64] constant equal to 1.
28-
static const Int64 ONE = Int64(1);
28+
static const Int64 ONE = Int64._(1);
2929

3030
/// An [Int64] constant equal to 2.
31-
static const Int64 TWO = Int64(2);
31+
static const Int64 TWO = Int64._(2);
3232

33-
const Int64([int value = 0]) : _i = value;
33+
const Int64._(this._i);
34+
35+
Int64([int value = 0]) : _i = value;
3436

3537
/// Constructs an [Int64] from a pair of 32-bit integers having the value
3638
/// [:((high & 0xffffffff) << 32) | (low & 0xffffffff):].

0 commit comments

Comments
 (0)