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 '../common.dart'; | 7 import '../common.dart'; |
8 import '../core_types.dart'; | 8 import '../core_types.dart'; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../elements/elements.dart' | 10 import '../elements/elements.dart' |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 659 |
660 class ConstructedConstantValue extends ObjectConstantValue { | 660 class ConstructedConstantValue extends ObjectConstantValue { |
661 // TODO(johnniwinther): Make [fields] private to avoid misuse of the map | 661 // TODO(johnniwinther): Make [fields] private to avoid misuse of the map |
662 // ordering and mutability. | 662 // ordering and mutability. |
663 final Map<FieldElement, ConstantValue> fields; | 663 final Map<FieldElement, ConstantValue> fields; |
664 final int hashCode; | 664 final int hashCode; |
665 | 665 |
666 ConstructedConstantValue( | 666 ConstructedConstantValue( |
667 InterfaceType type, Map<FieldElement, ConstantValue> fields) | 667 InterfaceType type, Map<FieldElement, ConstantValue> fields) |
668 : this.fields = fields, | 668 : this.fields = fields, |
669 hashCode = Hashing.mapHash(fields, Hashing.objectHash(type)), | 669 hashCode = Hashing.unorderedMapHash(fields, Hashing.objectHash(type)), |
670 super(type) { | 670 super(type) { |
671 assert(type != null); | 671 assert(type != null); |
672 assert(!fields.containsValue(null)); | 672 assert(!fields.containsValue(null)); |
673 } | 673 } |
674 | 674 |
675 bool get isConstructedObject => true; | 675 bool get isConstructedObject => true; |
676 | 676 |
677 bool operator ==(var otherVar) { | 677 bool operator ==(var otherVar) { |
678 if (identical(this, otherVar)) return true; | 678 if (identical(this, otherVar)) return true; |
679 if (otherVar is! ConstructedConstantValue) return false; | 679 if (otherVar is! ConstructedConstantValue) return false; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 775 |
776 @override | 776 @override |
777 DartType getType(CoreTypes types) => const DynamicType(); | 777 DartType getType(CoreTypes types) => const DynamicType(); |
778 | 778 |
779 @override | 779 @override |
780 String toStructuredText() => 'NonConstant'; | 780 String toStructuredText() => 'NonConstant'; |
781 | 781 |
782 @override | 782 @override |
783 String toDartText() => '>>non-constant<<'; | 783 String toDartText() => '>>non-constant<<'; |
784 } | 784 } |
OLD | NEW |