Skip to content

Commit 181c996

Browse files
osa1Commit Queue
authored and
Commit Queue
committed
[dart2wasm] Override runtime types of internal types
Runtime types of String, int, and double implementations are expected to be `String`, `int`, and `double`, respectively. Change-Id: I8f84ee2e8405c820a686d54449d3eb2db18eb52a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/276643 Commit-Queue: Ömer Ağacan <[email protected]> Reviewed-by: Aske Simon Christensen <[email protected]>
1 parent 419df9d commit 181c996

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

sdk/lib/_internal/wasm/lib/double.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ class _BoxedDouble extends double {
6363
/// Dummy factory to silence error about missing superclass constructor.
6464
external factory _BoxedDouble();
6565

66+
@override
67+
Type get runtimeType => double;
68+
6669
static const int _mantissaBits = 52;
6770
static const int _exponentBits = 11;
6871
static const int _exponentBias = 1023;

sdk/lib/_internal/wasm/lib/int.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class _BoxedInt extends int {
3131
/// Dummy factory to silence error about missing superclass constructor.
3232
external factory _BoxedInt();
3333

34+
@override
35+
Type get runtimeType => int;
36+
3437
external num operator +(num other);
3538
external num operator -(num other);
3639
external num operator *(num other);

sdk/lib/_internal/wasm/lib/string_patch.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ abstract class _StringBase implements String {
9595

9696
_StringBase._();
9797

98+
@override
99+
Type get runtimeType => String;
100+
98101
int get hashCode {
99102
int hash = _getHash(this);
100103
if (hash != 0) return hash;

0 commit comments

Comments
 (0)