| 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.generated.type_system; | 5 library analyzer.src.generated.type_system; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/token.dart' show TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show TokenType; |
| (...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 @override | 1659 @override |
| 1660 TypeImpl pruned(List<FunctionTypeAliasElement> prune) => | 1660 TypeImpl pruned(List<FunctionTypeAliasElement> prune) => |
| 1661 throw new UnsupportedError('Future unions are not substituted'); | 1661 throw new UnsupportedError('Future unions are not substituted'); |
| 1662 | 1662 |
| 1663 @override | 1663 @override |
| 1664 DartType substitute2(List<DartType> args, List<DartType> params, | 1664 DartType substitute2(List<DartType> args, List<DartType> params, |
| 1665 [List<FunctionTypeAliasElement> prune]) => | 1665 [List<FunctionTypeAliasElement> prune]) => |
| 1666 throw new UnsupportedError('Future unions are not used in typedefs'); | 1666 throw new UnsupportedError('Future unions are not used in typedefs'); |
| 1667 | 1667 |
| 1668 /** | 1668 /** |
| 1669 * Creates a union of `T | Future<T>`, unless `T` is already a future-union, | 1669 * Creates a union of `flatten(T) | Future<flatten(T)>`, unless `T` is |
| 1670 * in which case it simply returns `T` | 1670 * already a future-union, in which case it simply returns `T` |
| 1671 */ | 1671 */ |
| 1672 static DartType from( | 1672 static DartType from( |
| 1673 DartType type, TypeProvider provider, TypeSystem system) { | 1673 DartType type, TypeProvider provider, TypeSystem system) { |
| 1674 if (type is FutureUnionType) { | 1674 if (type is FutureUnionType) { |
| 1675 return type; | 1675 return type; |
| 1676 } | 1676 } |
| 1677 return new FutureUnionType(type, provider, system); | 1677 return new FutureUnionType(type, provider, system); |
| 1678 } | 1678 } |
| 1679 } | 1679 } |
| 1680 | 1680 |
| 1681 bool _isBottom(DartType t, {bool dynamicIsBottom: false}) { | 1681 bool _isBottom(DartType t, {bool dynamicIsBottom: false}) { |
| 1682 return (t.isDynamic && dynamicIsBottom) || t.isBottom; | 1682 return (t.isDynamic && dynamicIsBottom) || t.isBottom; |
| 1683 } | 1683 } |
| 1684 | 1684 |
| 1685 bool _isTop(DartType t, {bool dynamicIsBottom: false}) { | 1685 bool _isTop(DartType t, {bool dynamicIsBottom: false}) { |
| 1686 // TODO(leafp): Document the rules in play here | 1686 // TODO(leafp): Document the rules in play here |
| 1687 return (t.isDynamic && !dynamicIsBottom) || t.isObject; | 1687 return (t.isDynamic && !dynamicIsBottom) || t.isObject; |
| 1688 } | 1688 } |
| OLD | NEW |