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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 651 } |
652 | 652 |
653 DartType getType(CoreTypes types) => const DynamicType(); | 653 DartType getType(CoreTypes types) => const DynamicType(); |
654 | 654 |
655 String toDartText() => 'synthetic($kind, $payload)'; | 655 String toDartText() => 'synthetic($kind, $payload)'; |
656 | 656 |
657 String toStructuredText() => 'SyntheticConstant($kind, $payload)'; | 657 String toStructuredText() => 'SyntheticConstant($kind, $payload)'; |
658 } | 658 } |
659 | 659 |
660 class ConstructedConstantValue extends ObjectConstantValue { | 660 class ConstructedConstantValue extends ObjectConstantValue { |
| 661 // TODO(johnniwinther): Make [fields] private to avoid misuse of the map |
| 662 // ordering and mutability. |
661 final Map<FieldElement, ConstantValue> fields; | 663 final Map<FieldElement, ConstantValue> fields; |
662 final int hashCode; | 664 final int hashCode; |
663 | 665 |
664 ConstructedConstantValue( | 666 ConstructedConstantValue( |
665 InterfaceType type, Map<FieldElement, ConstantValue> fields) | 667 InterfaceType type, Map<FieldElement, ConstantValue> fields) |
666 : this.fields = fields, | 668 : this.fields = fields, |
667 hashCode = Hashing.mapHash(fields, Hashing.objectHash(type)), | 669 hashCode = Hashing.mapHash(fields, Hashing.objectHash(type)), |
668 super(type) { | 670 super(type) { |
669 assert(type != null); | 671 assert(type != null); |
670 assert(!fields.containsValue(null)); | 672 assert(!fields.containsValue(null)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 | 775 |
774 @override | 776 @override |
775 DartType getType(CoreTypes types) => const DynamicType(); | 777 DartType getType(CoreTypes types) => const DynamicType(); |
776 | 778 |
777 @override | 779 @override |
778 String toStructuredText() => 'NonConstant'; | 780 String toStructuredText() => 'NonConstant'; |
779 | 781 |
780 @override | 782 @override |
781 String toDartText() => '>>non-constant<<'; | 783 String toDartText() => '>>non-constant<<'; |
782 } | 784 } |
OLD | NEW |