| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 abstract class HType { | 5 abstract class HType { |
| 6 const HType(); | 6 const HType(); |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Returns an [HType] that represents [type] and all types that have | 9 * Returns an [HType] that represents [type] and all types that have |
| 10 * [type] as supertype. | 10 * [type] as supertype. |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 HType intersection(HType other) { | 755 HType intersection(HType other) { |
| 756 if (other.isString()) return HType.STRING; | 756 if (other.isString()) return HType.STRING; |
| 757 if (other.isStringOrNull()) { | 757 if (other.isStringOrNull()) { |
| 758 return canBeNull() ? HType.STRING_OR_NULL : HType.STRING; | 758 return canBeNull() ? HType.STRING_OR_NULL : HType.STRING; |
| 759 } | 759 } |
| 760 if (other.isReadableArray()) return HType.CONFLICTING; | 760 if (other.isReadableArray()) return HType.CONFLICTING; |
| 761 if (other.isIndexablePrimitive()) return HType.STRING; | 761 if (other.isIndexablePrimitive()) return HType.STRING; |
| 762 return super.intersection(other); | 762 return super.intersection(other); |
| 763 } | 763 } |
| 764 } | 764 } |
| 765 |
| 766 class HTypeMap { |
| 767 Map<HInstruction, HType> _map; |
| 768 |
| 769 HTypeMap() : _map = new Map<HInstruction, HType>(); |
| 770 |
| 771 operator [](HInstruction instruction) { |
| 772 HType result = _map[instruction]; |
| 773 if (result == null) return instruction.guaranteedType; |
| 774 return result; |
| 775 } |
| 776 |
| 777 operator []=(HInstruction instruction, HType value) { |
| 778 _map[instruction] = value; |
| 779 } |
| 780 } |
| OLD | NEW |