| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.serialization; | 5 library dart2js.serialization; |
| 6 | 6 |
| 7 import 'package:front_end/src/scanner/token.dart' show TokenType; | 7 import 'package:front_end/src/scanner/token.dart' show TokenType; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../common/resolution.dart'; | 10 import '../common/resolution.dart'; |
| 11 import '../constants/expressions.dart'; | 11 import '../constants/expressions.dart'; |
| 12 import '../elements/resolution_types.dart'; | 12 import '../elements/resolution_types.dart'; |
| 13 import '../elements/elements.dart'; | 13 import '../elements/elements.dart'; |
| 14 import '../library_loader.dart' show LibraryProvider; | 14 import '../library_loader.dart' show LibraryProvider; |
| 15 import '../util/enumset.dart'; | 15 import '../util/enumset.dart'; |
| 16 import 'constant_serialization.dart'; | 16 import 'constant_serialization.dart'; |
| 17 import 'element_serialization.dart'; | 17 import 'element_serialization.dart'; |
| 18 import 'json_serializer.dart'; | 18 import 'json_serializer.dart'; |
| 19 import 'keys.dart'; | 19 import 'keys.dart'; |
| 20 import 'type_serialization.dart'; | 20 import 'type_serialization.dart'; |
| 21 import 'values.dart'; | 21 import 'values.dart'; |
| 22 | 22 |
| 23 export 'task.dart' show LibraryDeserializer; | 23 export 'task.dart' show LibraryDeserializer; |
| 24 | 24 |
| 25 final Map<String, String> canonicalNames = computeCanonicalNames(); | 25 final Map<String, String> canonicalNames = computeCanonicalNames(); |
| 26 | 26 |
| 27 Map<String, String> computeCanonicalNames() { | 27 Map<String, String> computeCanonicalNames() { |
| 28 Map<String, String> result = <String, String>{}; | 28 Map<String, String> result = <String, String>{}; |
| 29 for (TokenType info in TokenType.all) { | 29 for (TokenType type in TokenType.all) { |
| 30 result[info.value] = info.value; | 30 result[type.value] = type.value; |
| 31 } | 31 } |
| 32 return result; | 32 return result; |
| 33 } | 33 } |
| 34 | 34 |
| 35 /// An object that supports the encoding an [ObjectValue] for serialization. | 35 /// An object that supports the encoding an [ObjectValue] for serialization. |
| 36 /// | 36 /// |
| 37 /// The [ObjectEncoder] ensures that nominality and circularities of | 37 /// The [ObjectEncoder] ensures that nominality and circularities of |
| 38 /// non-primitive values like [Element], [ResolutionDartType] and | 38 /// non-primitive values like [Element], [ResolutionDartType] and |
| 39 /// [ConstantExpression] are handled. | 39 /// [ConstantExpression] are handled. |
| 40 class ObjectEncoder extends AbstractEncoder<Key> { | 40 class ObjectEncoder extends AbstractEncoder<Key> { |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 | 1151 |
| 1152 /// Returns the value used to store [key] as a property in the encoding an | 1152 /// Returns the value used to store [key] as a property in the encoding an |
| 1153 /// [ObjectValue]. | 1153 /// [ObjectValue]. |
| 1154 /// | 1154 /// |
| 1155 /// Different encodings have different restrictions and capabilities as how | 1155 /// Different encodings have different restrictions and capabilities as how |
| 1156 /// to store a [Key] value. For instance: A JSON encoding needs to convert | 1156 /// to store a [Key] value. For instance: A JSON encoding needs to convert |
| 1157 /// [Key] to a [String] to store it in a JSON object; a Dart encoding can | 1157 /// [Key] to a [String] to store it in a JSON object; a Dart encoding can |
| 1158 /// choose to store a [Key] as an [int] or as the [Key] itself. | 1158 /// choose to store a [Key] as an [int] or as the [Key] itself. |
| 1159 getObjectPropertyValue(Key key); | 1159 getObjectPropertyValue(Key key); |
| 1160 } | 1160 } |
| OLD | NEW |