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 '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
8 import '../constants/expressions.dart'; | 8 import '../constants/expressions.dart'; |
9 import '../dart_types.dart'; | 9 import '../dart_types.dart'; |
10 import '../util/enumset.dart'; | 10 import '../util/enumset.dart'; |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 | 675 |
676 /// Returns the id [Value] for [element]. | 676 /// Returns the id [Value] for [element]. |
677 /// | 677 /// |
678 /// If [element] has no [DataObject], a new [DataObject] is created and | 678 /// If [element] has no [DataObject], a new [DataObject] is created and |
679 /// encoding the [ObjectValue] for [element] is put into the work queue of | 679 /// encoding the [ObjectValue] for [element] is put into the work queue of |
680 /// this serializer. | 680 /// this serializer. |
681 Value _getElementId(Element element) { | 681 Value _getElementId(Element element) { |
682 if (element == null) { | 682 if (element == null) { |
683 throw new ArgumentError('Serializer._getElementDataObject(null)'); | 683 throw new ArgumentError('Serializer._getElementDataObject(null)'); |
684 } | 684 } |
| 685 element = element.declaration; |
685 DataObject dataObject = _elementMap[element]; | 686 DataObject dataObject = _elementMap[element]; |
686 if (dataObject == null) { | 687 if (dataObject == null) { |
687 if (!shouldInclude(element)) { | 688 if (!shouldInclude(element)) { |
688 if (element.isLibrary) { | 689 if (element.isLibrary) { |
689 LibraryElement library = element; | 690 LibraryElement library = element; |
690 _elementMap[element] = dataObject = new DataObject( | 691 _elementMap[element] = dataObject = new DataObject( |
691 new IntValue(_elementMap.length), | 692 new IntValue(_elementMap.length), |
692 new EnumValue(SerializedElementKind.EXTERNAL_LIBRARY)); | 693 new EnumValue(SerializedElementKind.EXTERNAL_LIBRARY)); |
693 ObjectEncoder encoder = new ObjectEncoder(this, dataObject.map); | 694 ObjectEncoder encoder = new ObjectEncoder(this, dataObject.map); |
694 encoder.setUri(Key.URI, library.canonicalUri, library.canonicalUri); | 695 encoder.setUri(Key.URI, library.canonicalUri, library.canonicalUri); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 | 1034 |
1034 /// Returns the value used to store [key] as a property in the encoding an | 1035 /// Returns the value used to store [key] as a property in the encoding an |
1035 /// [ObjectValue]. | 1036 /// [ObjectValue]. |
1036 /// | 1037 /// |
1037 /// Different encodings have different restrictions and capabilities as how | 1038 /// Different encodings have different restrictions and capabilities as how |
1038 /// to store a [Key] value. For instance: A JSON encoding needs to convert | 1039 /// to store a [Key] value. For instance: A JSON encoding needs to convert |
1039 /// [Key] to a [String] to store it in a JSON object; a Dart encoding can | 1040 /// [Key] to a [String] to store it in a JSON object; a Dart encoding can |
1040 /// choose to store a [Key] as an [int] or as the [Key] itself. | 1041 /// choose to store a [Key] as an [int] or as the [Key] itself. |
1041 getObjectPropertyValue(Key key); | 1042 getObjectPropertyValue(Key key); |
1042 } | 1043 } |
OLD | NEW |