| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 compiler.src.inferrer.type_graph_nodes; | 5 library compiler.src.inferrer.type_graph_nodes; |
| 6 | 6 |
| 7 import 'dart:collection' show IterableBase; | 7 import 'dart:collection' show IterableBase; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/names.dart' show Identifiers; | 10 import '../common/names.dart' show Identifiers; |
| 11 import '../compiler.dart' show Compiler; | 11 import '../compiler.dart' show Compiler; |
| 12 import '../constants/values.dart'; | 12 import '../constants/values.dart'; |
| 13 import '../cps_ir/cps_ir_nodes.dart' as cps_ir show Node; | 13 import '../cps_ir/cps_ir_nodes.dart' as cps_ir show Node; |
| 14 import '../dart_types.dart' show DartType, FunctionType, TypeKind; | 14 import '../dart_types.dart' show DartType, FunctionType, TypeKind; |
| 15 import '../elements/elements.dart'; | 15 import '../elements/elements.dart'; |
| 16 import '../native/native.dart' as native; | 16 import '../native/native.dart' as native; |
| 17 import '../tree/tree.dart' as ast show DartString, Node, LiteralBool, Send; | 17 import '../tree/tree.dart' as ast show Node, LiteralBool, Send; |
| 18 import '../tree/dartstring.dart' show DartString; |
| 18 import '../types/types.dart' | 19 import '../types/types.dart' |
| 19 show | 20 show |
| 20 ContainerTypeMask, | 21 ContainerTypeMask, |
| 21 DictionaryTypeMask, | 22 DictionaryTypeMask, |
| 22 MapTypeMask, | 23 MapTypeMask, |
| 23 TypeMask, | 24 TypeMask, |
| 24 ValueTypeMask; | 25 ValueTypeMask; |
| 25 import '../universe/selector.dart' show Selector; | 26 import '../universe/selector.dart' show Selector; |
| 26 import '../util/util.dart' show ImmutableEmptySet, Setlet; | 27 import '../util/util.dart' show ImmutableEmptySet, Setlet; |
| 27 import '../world.dart' show ClassWorld; | 28 import '../world.dart' show ClassWorld; |
| (...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 String toString() => 'Type $type'; | 1203 String toString() => 'Type $type'; |
| 1203 | 1204 |
| 1204 accept(TypeInformationVisitor visitor) { | 1205 accept(TypeInformationVisitor visitor) { |
| 1205 return visitor.visitConcreteTypeInformation(this); | 1206 return visitor.visitConcreteTypeInformation(this); |
| 1206 } | 1207 } |
| 1207 | 1208 |
| 1208 bool hasStableType(TypeGraphInferrerEngine inferrer) => true; | 1209 bool hasStableType(TypeGraphInferrerEngine inferrer) => true; |
| 1209 } | 1210 } |
| 1210 | 1211 |
| 1211 class StringLiteralTypeInformation extends ConcreteTypeInformation { | 1212 class StringLiteralTypeInformation extends ConcreteTypeInformation { |
| 1212 final ast.DartString value; | 1213 final DartString value; |
| 1213 | 1214 |
| 1214 StringLiteralTypeInformation(value, TypeMask mask) | 1215 StringLiteralTypeInformation(value, TypeMask mask) |
| 1215 : super(new ValueTypeMask(mask, new StringConstantValue(value))), | 1216 : super(new ValueTypeMask(mask, new StringConstantValue(value))), |
| 1216 this.value = value; | 1217 this.value = value; |
| 1217 | 1218 |
| 1218 String asString() => value.slowToString(); | 1219 String asString() => value.slowToString(); |
| 1219 String toString() => 'Type $type value ${value.slowToString()}'; | 1220 String toString() => 'Type $type value ${value.slowToString()}'; |
| 1220 | 1221 |
| 1221 accept(TypeInformationVisitor visitor) { | 1222 accept(TypeInformationVisitor visitor) { |
| 1222 return visitor.visitStringLiteralTypeInformation(this); | 1223 return visitor.visitStringLiteralTypeInformation(this); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 } else if (annotation.isVoid) { | 1733 } else if (annotation.isVoid) { |
| 1733 otherType = compiler.typesTask.nullType; | 1734 otherType = compiler.typesTask.nullType; |
| 1734 } else { | 1735 } else { |
| 1735 assert(annotation.isInterfaceType); | 1736 assert(annotation.isInterfaceType); |
| 1736 otherType = new TypeMask.nonNullSubtype(annotation.element, compiler.world); | 1737 otherType = new TypeMask.nonNullSubtype(annotation.element, compiler.world); |
| 1737 } | 1738 } |
| 1738 if (isNullable) otherType = otherType.nullable(); | 1739 if (isNullable) otherType = otherType.nullable(); |
| 1739 if (type == null) return otherType; | 1740 if (type == null) return otherType; |
| 1740 return type.intersection(otherType, compiler.world); | 1741 return type.intersection(otherType, compiler.world); |
| 1741 } | 1742 } |
| OLD | NEW |