OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.src.summary.summary_sdk; | 5 library analyzer.src.summary.summary_sdk; |
6 | 6 |
7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
8 import 'package:analyzer/dart/element/type.dart'; | 8 import 'package:analyzer/dart/element/type.dart'; |
9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; | 9 import 'package:analyzer/src/context/cache.dart' show CacheEntry; |
10 import 'package:analyzer/src/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 @override | 343 @override |
344 InterfaceType get futureDynamicType { | 344 InterfaceType get futureDynamicType { |
345 assert(_asyncLibrary != null); | 345 assert(_asyncLibrary != null); |
346 _futureDynamicType ??= futureType.instantiate(<DartType>[dynamicType]); | 346 _futureDynamicType ??= futureType.instantiate(<DartType>[dynamicType]); |
347 return _futureDynamicType; | 347 return _futureDynamicType; |
348 } | 348 } |
349 | 349 |
350 @override | 350 @override |
351 InterfaceType get futureNullType { | 351 InterfaceType get futureNullType { |
352 assert(_asyncLibrary != null); | 352 assert(_asyncLibrary != null); |
353 _futureNullType ??= futureType.instantiate(<DartType>[_nullType]); | 353 _futureNullType ??= futureType.instantiate(<DartType>[nullType]); |
354 return _futureNullType; | 354 return _futureNullType; |
355 } | 355 } |
356 | 356 |
357 @override | 357 @override |
358 InterfaceType get futureType { | 358 InterfaceType get futureType { |
359 assert(_asyncLibrary != null); | 359 assert(_asyncLibrary != null); |
360 _futureType ??= _getType(_asyncLibrary, "Future"); | 360 _futureType ??= _getType(_asyncLibrary, "Future"); |
361 return _futureType; | 361 return _futureType; |
362 } | 362 } |
363 | 363 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 * throw a [StateError] if there is no class with the given name. | 503 * throw a [StateError] if there is no class with the given name. |
504 */ | 504 */ |
505 InterfaceType _getType(LibraryElement library, String name) { | 505 InterfaceType _getType(LibraryElement library, String name) { |
506 Element element = library.getType(name); | 506 Element element = library.getType(name); |
507 if (element == null) { | 507 if (element == null) { |
508 throw new StateError("No definition of type $name"); | 508 throw new StateError("No definition of type $name"); |
509 } | 509 } |
510 return (element as ClassElement).type; | 510 return (element as ClassElement).type; |
511 } | 511 } |
512 } | 512 } |
OLD | NEW |