Change JSArray.length to return int (flutter/engine#54051)

This is in preparation for
https://dart-review.googlesource.com/c/sdk/+/373884, which will add length to the extension type itself. This will shadow the extension member, so we should make sure the type signatures match.
This commit is contained in:
Srujan Gaddam
2024-07-23 18:12:19 -07:00
committed by GitHub
parent fa03262127
commit 0f69778e71
2 changed files with 4 additions and 6 deletions

View File

@@ -3763,9 +3763,8 @@ bool get browserSupportsCreateImageBitmap =>
!isChrome110OrOlder &&
!debugDisableCreateImageBitmapSupport;
@JS()
@staticInterop
extension JSArrayExtension on JSArray<JSAny?> {
external void push(JSAny value);
external JSNumber get length;
// TODO(srujzs): Delete this when we add `JSArray.length` in the SDK.
external int get length;
}

View File

@@ -50,8 +50,7 @@ void doTests() {
HotRestartCacheHandler();
expect(_jsHotRestartStore, isNotNull);
// For dart2wasm, we have to check the length this way.
expect(_jsHotRestartStore!.length, 0.toJS);
expect(_jsHotRestartStore!.length, 0);
});
});
@@ -94,7 +93,7 @@ void doTests() {
cache = HotRestartCacheHandler();
// For dart2wasm, we have to check the length this way.
expect(_jsHotRestartStore!.length, 0.toJS);
expect(_jsHotRestartStore!.length, 0);
expect(element.isConnected, isFalse); // Removed
expect(element2.isConnected, isTrue);
});