@@ -178,37 +178,38 @@ abstract class CommonElements {
178178 /// [elementType] as its type argument.
179179 ///
180180 /// If no type argument is provided, the canonical raw type is returned.
181- InterfaceType listType ([DartType elementType]);
181+ InterfaceType listType (Nullability nullability, [DartType elementType]);
182182
183183 /// Returns an instance of the `Set` type defined in 'dart:core' with
184184 /// [elementType] as its type argument.
185185 ///
186186 /// If no type argument is provided, the canonical raw type is returned.
187- InterfaceType setType ([DartType elementType]);
187+ InterfaceType setType (Nullability nullability, [DartType elementType]);
188188
189189 /// Returns an instance of the `Map` type defined in 'dart:core' with
190190 /// [keyType] and [valueType] as its type arguments.
191191 ///
192192 /// If no type arguments are provided, the canonical raw type is returned.
193- InterfaceType mapType ([DartType keyType, DartType valueType]);
193+ InterfaceType mapType (Nullability nullability,
194+ [DartType keyType, DartType valueType]);
194195
195196 /// Returns an instance of the `Iterable` type defined in 'dart:core' with
196197 /// [elementType] as its type argument.
197198 ///
198199 /// If no type argument is provided, the canonical raw type is returned.
199- InterfaceType iterableType ([DartType elementType]);
200+ InterfaceType iterableType (Nullability nullability, [DartType elementType]);
200201
201202 /// Returns an instance of the `Future` type defined in 'dart:async' with
202203 /// [elementType] as its type argument.
203204 ///
204205 /// If no type argument is provided, the canonical raw type is returned.
205- InterfaceType futureType ([DartType elementType]);
206+ InterfaceType futureType (Nullability nullability, [DartType elementType]);
206207
207208 /// Returns an instance of the `Stream` type defined in 'dart:async' with
208209 /// [elementType] as its type argument.
209210 ///
210211 /// If no type argument is provided, the canonical raw type is returned.
211- InterfaceType streamType ([DartType elementType]);
212+ InterfaceType streamType (Nullability nullability, [DartType elementType]);
212213
213214 /// Returns `true` if [element] is a superclass of `String` or `num` .
214215 bool isNumberOrStringSupertype (ClassEntity element);
@@ -928,55 +929,56 @@ class CommonElementsImpl
928929 InterfaceType get stackTraceType => _getRawType (stackTraceClass);
929930
930931 @override
931- InterfaceType listType ([DartType elementType]) {
932+ InterfaceType listType (Nullability nullability, [DartType elementType]) {
932933 if (elementType == null ) {
933934 return _getRawType (listClass);
934935 }
935- return _createInterfaceType (listClass, [elementType]);
936+ return _createInterfaceType (listClass, [elementType], nullability );
936937 }
937938
938939 @override
939- InterfaceType setType ([DartType elementType]) {
940+ InterfaceType setType (Nullability nullability, [DartType elementType]) {
940941 if (elementType == null ) {
941942 return _getRawType (setClass);
942943 }
943- return _createInterfaceType (setClass, [elementType]);
944+ return _createInterfaceType (setClass, [elementType], nullability );
944945 }
945946
946947 @override
947- InterfaceType mapType ([DartType keyType, DartType valueType]) {
948+ InterfaceType mapType (Nullability nullability,
949+ [DartType keyType, DartType valueType]) {
948950 if (keyType == null && valueType == null ) {
949951 return _getRawType (mapClass);
950952 } else if (keyType == null ) {
951953 keyType = dynamicType;
952954 } else if (valueType == null ) {
953955 valueType = dynamicType;
954956 }
955- return _createInterfaceType (mapClass, [keyType, valueType]);
957+ return _createInterfaceType (mapClass, [keyType, valueType], nullability );
956958 }
957959
958960 @override
959- InterfaceType iterableType ([DartType elementType]) {
961+ InterfaceType iterableType (Nullability nullability, [DartType elementType]) {
960962 if (elementType == null ) {
961963 return _getRawType (iterableClass);
962964 }
963- return _createInterfaceType (iterableClass, [elementType]);
965+ return _createInterfaceType (iterableClass, [elementType], nullability );
964966 }
965967
966968 @override
967- InterfaceType futureType ([DartType elementType]) {
969+ InterfaceType futureType (Nullability nullability, [DartType elementType]) {
968970 if (elementType == null ) {
969971 return _getRawType (futureClass);
970972 }
971- return _createInterfaceType (futureClass, [elementType]);
973+ return _createInterfaceType (futureClass, [elementType], nullability );
972974 }
973975
974976 @override
975- InterfaceType streamType ([DartType elementType]) {
977+ InterfaceType streamType (Nullability nullability, [DartType elementType]) {
976978 if (elementType == null ) {
977979 return _getRawType (streamClass);
978980 }
979- return _createInterfaceType (streamClass, [elementType]);
981+ return _createInterfaceType (streamClass, [elementType], nullability );
980982 }
981983
982984 @override
@@ -1021,38 +1023,40 @@ class CommonElementsImpl
10211023 return _env.getRawType (cls);
10221024 }
10231025
1024- /// Create the instantiation of [cls] with the given [typeArguments] .
1026+ /// Create the instantiation of [cls] with the given [typeArguments] and
1027+ /// [nullability] .
10251028 InterfaceType _createInterfaceType (
1026- ClassEntity cls, List <DartType > typeArguments) {
1027- return _env.createInterfaceType (cls, typeArguments);
1029+ ClassEntity cls, List <DartType > typeArguments, Nullability nullability ) {
1030+ return _env.createInterfaceType (cls, typeArguments, nullability );
10281031 }
10291032
10301033 @override
10311034 InterfaceType getConstantListTypeFor (InterfaceType sourceType) =>
10321035 dartTypes.treatAsRawType (sourceType)
10331036 ? _env.getRawType (jsArrayClass)
1034- : _env.createInterfaceType (jsArrayClass, sourceType.typeArguments);
1037+ : _env.createInterfaceType (
1038+ jsArrayClass, sourceType.typeArguments, sourceType.nullability);
10351039
10361040 @override
10371041 InterfaceType getConstantMapTypeFor (InterfaceType sourceType,
10381042 {bool hasProtoKey: false , bool onlyStringKeys: false }) {
10391043 ClassEntity classElement = onlyStringKeys
10401044 ? (hasProtoKey ? constantProtoMapClass : constantStringMapClass)
10411045 : generalConstantMapClass;
1042- List <DartType > typeArgument = sourceType.typeArguments;
10431046 if (dartTypes.treatAsRawType (sourceType)) {
10441047 return _env.getRawType (classElement);
10451048 } else {
1046- return _env.createInterfaceType (classElement, typeArgument);
1049+ return _env.createInterfaceType (
1050+ classElement, sourceType.typeArguments, sourceType.nullability);
10471051 }
10481052 }
10491053
10501054 @override
10511055 InterfaceType getConstantSetTypeFor (InterfaceType sourceType) =>
10521056 dartTypes.treatAsRawType (sourceType)
10531057 ? _env.getRawType (constSetLiteralClass)
1054- : _env.createInterfaceType (
1055- constSetLiteralClass , sourceType.typeArguments );
1058+ : _env.createInterfaceType (constSetLiteralClass,
1059+ sourceType.typeArguments , sourceType.nullability );
10561060
10571061 @override
10581062 FieldEntity get symbolField => symbolImplementationField;
@@ -2285,9 +2289,10 @@ abstract class ElementEnvironment {
22852289 /// Calls [f] for each supertype of [cls] .
22862290 void forEachSupertype (ClassEntity cls, void f (InterfaceType supertype));
22872291
2288- /// Create the instantiation of [cls] with the given [typeArguments] .
2292+ /// Create the instantiation of [cls] with the given [typeArguments] and
2293+ /// [nullability] .
22892294 InterfaceType createInterfaceType (
2290- ClassEntity cls, List <DartType > typeArguments);
2295+ ClassEntity cls, List <DartType > typeArguments, Nullability nullability );
22912296
22922297 /// Returns the `dynamic` type.
22932298 DartType get dynamicType;
0 commit comments