@@ -271,7 +271,7 @@ final _subtypeCache = JS('', 'Symbol("_subtypeCache")');
271
271
/// normalization doc:
272
272
/// https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md
273
273
@notNull
274
- Object nullable (type) {
274
+ Object nullable (@notNull Object type) {
275
275
// Check if a nullable version of this type has already been created.
276
276
var cached = JS <Object >('' , '#[#]' , type, _cachedNullable);
277
277
if (JS <bool >('!' , '# !== void 0' , cached)) {
@@ -284,7 +284,7 @@ Object nullable(type) {
284
284
return cachedType;
285
285
}
286
286
287
- Object _computeNullable (type) {
287
+ Object _computeNullable (@notNull Object type) {
288
288
// *? normalizes to ?.
289
289
if (_jsInstanceOf (type, LegacyType )) {
290
290
return nullable (JS <Object >('!' , '#.type' , type));
@@ -309,7 +309,7 @@ Object _computeNullable(type) {
309
309
/// normalization doc:
310
310
/// https://github.com/dart-lang/language/blob/master/resources/type-system/normalization.md
311
311
@notNull
312
- Object legacy (type) {
312
+ Object legacy (@notNull Object type) {
313
313
// Check if a legacy version of this type has already been created.
314
314
var cached = JS <Object >('' , '#[#]' , type, _cachedLegacy);
315
315
if (JS <bool >('!' , '# !== void 0' , cached)) {
@@ -322,7 +322,7 @@ Object legacy(type) {
322
322
return cachedType;
323
323
}
324
324
325
- Object _computeLegacy (type) {
325
+ Object _computeLegacy (@notNull Object type) {
326
326
// Note: ?* normalizes to ?, so we cache type? at type?[_cachedLegacy].
327
327
if (_jsInstanceOf (type, LegacyType ) ||
328
328
_jsInstanceOf (type, NullableType ) ||
@@ -337,7 +337,7 @@ Object _computeLegacy(type) {
337
337
class NullableType extends DartType {
338
338
final Type type;
339
339
340
- NullableType (this .type);
340
+ NullableType (@notNull this .type);
341
341
342
342
@override
343
343
String get name => '$type ?' ;
@@ -358,7 +358,7 @@ class NullableType extends DartType {
358
358
class LegacyType extends DartType {
359
359
final Type type;
360
360
361
- LegacyType (this .type);
361
+ LegacyType (@notNull this .type);
362
362
363
363
@override
364
364
String get name => '$type ' ;
@@ -1140,7 +1140,7 @@ String typeName(type) => JS('', '''(() => {
1140
1140
})()''' );
1141
1141
1142
1142
/// Returns true if [ft1] <: [ft2] .
1143
- _isFunctionSubtype (ft1, ft2, bool strictMode) => JS ('' , '''(() => {
1143
+ _isFunctionSubtype (ft1, ft2, @notNull bool strictMode) => JS ('' , '''(() => {
1144
1144
let ret1 = $ft1 .returnType;
1145
1145
let ret2 = $ft2 .returnType;
1146
1146
@@ -1233,7 +1233,7 @@ _isFunctionSubtype(ft1, ft2, bool strictMode) => JS('', '''(() => {
1233
1233
1234
1234
/// Returns true if [t1] <: [t2] .
1235
1235
@notNull
1236
- bool isSubtypeOf (Object t1, Object t2) {
1236
+ bool isSubtypeOf (@notNull Object t1, @notNull Object t2) {
1237
1237
// TODO(jmesserly): we've optimized `is`/`as`/implicit type checks, so they're
1238
1238
// dispatched on the type. Can we optimize the subtype relation too?
1239
1239
var map = JS <Object >('!' , '#[#]' , t1, _subtypeCache);
@@ -1313,7 +1313,7 @@ bool _isFutureOr(type) {
1313
1313
}
1314
1314
1315
1315
@notNull
1316
- bool _isSubtype (t1, t2, bool strictMode) => JS <bool >('!' , '''(() => {
1316
+ bool _isSubtype (t1, t2, @notNull bool strictMode) => JS <bool >('!' , '''(() => {
1317
1317
if (!$strictMode ) {
1318
1318
// Strip nullable types when performing check in weak mode.
1319
1319
// TODO(nshahan) Investigate stripping off legacy types as well.
@@ -1504,7 +1504,7 @@ bool _isSubtype(t1, t2, bool strictMode) => JS<bool>('!', '''(() => {
1504
1504
return ${_isFunctionSubtype (t1 , t2 , strictMode )};
1505
1505
})()''' );
1506
1506
1507
- bool _isInterfaceSubtype (t1, t2, strictMode) => JS ('' , '''(() => {
1507
+ bool _isInterfaceSubtype (t1, t2, @notNull bool strictMode) => JS ('' , '''(() => {
1508
1508
// If we have lazy JS types, unwrap them. This will effectively
1509
1509
// reduce to a prototype check below.
1510
1510
if (${_jsInstanceOf (t1 , LazyJSType )}) $t1 = $t1 .rawJSTypeForCheck();
0 commit comments