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 library dart2js.constants.values; | 5 library dart2js.constants.values; |
6 | 6 |
7 import '../core_types.dart'; | 7 import '../core_types.dart'; |
8 import '../dart_types.dart'; | 8 import '../dart_types.dart'; |
9 import '../dart2jslib.dart' | 9 import '../dart2jslib.dart' |
10 show assertDebugMode; | 10 show assertDebugMode; |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 class ConstructedConstantValue extends ObjectConstantValue { | 632 class ConstructedConstantValue extends ObjectConstantValue { |
633 final Map<FieldElement, ConstantValue> fields; | 633 final Map<FieldElement, ConstantValue> fields; |
634 final int hashCode; | 634 final int hashCode; |
635 | 635 |
636 ConstructedConstantValue(InterfaceType type, | 636 ConstructedConstantValue(InterfaceType type, |
637 Map<FieldElement, ConstantValue> fields) | 637 Map<FieldElement, ConstantValue> fields) |
638 : this.fields = fields, | 638 : this.fields = fields, |
639 hashCode = Hashing.mapHash(fields, Hashing.objectHash(type)), | 639 hashCode = Hashing.mapHash(fields, Hashing.objectHash(type)), |
640 super(type) { | 640 super(type) { |
641 assert(type != null); | 641 assert(type != null); |
| 642 assert(!fields.containsValue(null)); |
642 } | 643 } |
643 | 644 |
644 bool get isConstructedObject => true; | 645 bool get isConstructedObject => true; |
645 | 646 |
646 bool operator ==(var otherVar) { | 647 bool operator ==(var otherVar) { |
647 if (otherVar is !ConstructedConstantValue) return false; | 648 if (otherVar is !ConstructedConstantValue) return false; |
648 ConstructedConstantValue other = otherVar; | 649 ConstructedConstantValue other = otherVar; |
649 if (hashCode != other.hashCode) return false; | 650 if (hashCode != other.hashCode) return false; |
650 if (type != other.type) return false; | 651 if (type != other.type) return false; |
651 if (fields.length != other.fields.length) return false; | 652 if (fields.length != other.fields.length) return false; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 742 |
742 @override | 743 @override |
743 DartType getType(CoreTypes types) => const DynamicType(); | 744 DartType getType(CoreTypes types) => const DynamicType(); |
744 | 745 |
745 @override | 746 @override |
746 String toStructuredString() => 'NonConstant'; | 747 String toStructuredString() => 'NonConstant'; |
747 | 748 |
748 @override | 749 @override |
749 String unparse() => '>>non-constant<<'; | 750 String unparse() => '>>non-constant<<'; |
750 } | 751 } |
OLD | NEW |