[dart:html] Add nullability to item type for lists

Needed to type nullability for List parameters correctly.

Change-Id: I55732a34f9e221324a15312985cb83b49a6811a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142211
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
This commit is contained in:
Srujan Gaddam 2020-04-06 21:37:44 +00:00 committed by commit-bot@chromium.org
parent a925f4770f
commit b96cd6d755
3 changed files with 7 additions and 5 deletions

View file

@ -22525,7 +22525,7 @@ class Navigator extends NavigatorConcurrentHardware
NavigatorOnLine,
NavigatorAutomationInformation,
NavigatorID {
List<Gamepad> getGamepads() {
List<Gamepad?> getGamepads() {
var gamepadList = _getGamepads();
// If no prototype we need one for the world to hookup to the proper Dart class.
@ -22677,7 +22677,7 @@ class Navigator extends NavigatorConcurrentHardware
@JSName('getGamepads')
@Returns('_GamepadList')
@Creates('_GamepadList')
List<Gamepad> _getGamepads() native;
List<Gamepad?> _getGamepads() native;
Future<RelatedApplication> getInstalledRelatedApps() =>
promiseToFuture<RelatedApplication>(

View file

@ -1271,8 +1271,10 @@ class InterfaceIDLTypeInfo(IDLTypeInfo):
if self._data.dart_type:
return self._data.dart_type
if self.list_item_type() and not self.has_generated_interface():
return 'List<%s>' % self._type_registry.TypeInfo(
self._data.item_type).dart_type()
item_nullable = '?' if self._data.item_type_nullable and \
global_options_hack.nnbd else ''
return 'List<%s%s>' % (self._type_registry.TypeInfo(
self._data.item_type).dart_type(), item_nullable)
return self._dart_interface_name
def narrow_dart_type(self):

View file

@ -6,7 +6,7 @@ part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
List<Gamepad> getGamepads() {
List<Gamepad$NULLABLE> getGamepads() {
var gamepadList = _getGamepads();
// If no prototype we need one for the world to hookup to the proper Dart class.