| 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.elements; | 5 library dart2js.serialization.elements; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../constants/constructors.dart'; | 8 import '../constants/constructors.dart'; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../elements/resolution_types.dart'; | 10 import '../elements/resolution_types.dart'; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 list ??= encoder.createList(Key.METADATA); | 159 list ??= encoder.createList(Key.METADATA); |
| 160 element.implementation.metadata.forEach(encodeAnnotation); | 160 element.implementation.metadata.forEach(encodeAnnotation); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 /// Serialize the parent relation for [element] into [encoder], i.e library, | 164 /// Serialize the parent relation for [element] into [encoder], i.e library, |
| 165 /// enclosing class, and compilation unit references. | 165 /// enclosing class, and compilation unit references. |
| 166 static void serializeParentRelation(Element element, ObjectEncoder encoder) { | 166 static void serializeParentRelation(Element element, ObjectEncoder encoder) { |
| 167 if (element.enclosingClass != null) { | 167 if (element.enclosingClass != null) { |
| 168 encoder.setElement(Key.CLASS, element.enclosingClass); | 168 encoder.setElement(Key.CLASS, element.enclosingClass); |
| 169 if (element.enclosingClass.declaration.compilationUnit != | 169 if (element.enclosingClass.compilationUnit != element.compilationUnit) { |
| 170 element.compilationUnit) { | |
| 171 encoder.setElement(Key.COMPILATION_UNIT, element.compilationUnit); | 170 encoder.setElement(Key.COMPILATION_UNIT, element.compilationUnit); |
| 172 } | 171 } |
| 173 } else { | 172 } else { |
| 174 encoder.setElement(Key.LIBRARY, element.library); | 173 encoder.setElement(Key.LIBRARY, element.library); |
| 175 encoder.setElement(Key.COMPILATION_UNIT, element.compilationUnit); | 174 encoder.setElement(Key.COMPILATION_UNIT, element.compilationUnit); |
| 176 } | 175 } |
| 177 } | 176 } |
| 178 | 177 |
| 179 /// Serialize the parameters of [element] into [encoder]. | 178 /// Serialize the parameters of [element] into [encoder]. |
| 180 static void serializeParameters( | 179 static void serializeParameters( |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 enclosingElement, existingElement, newElement); | 949 enclosingElement, existingElement, newElement); |
| 951 case SerializedElementKind.EXTERNAL_LIBRARY: | 950 case SerializedElementKind.EXTERNAL_LIBRARY: |
| 952 case SerializedElementKind.EXTERNAL_LIBRARY_MEMBER: | 951 case SerializedElementKind.EXTERNAL_LIBRARY_MEMBER: |
| 953 case SerializedElementKind.EXTERNAL_CLASS_MEMBER: | 952 case SerializedElementKind.EXTERNAL_CLASS_MEMBER: |
| 954 case SerializedElementKind.EXTERNAL_CONSTRUCTOR: | 953 case SerializedElementKind.EXTERNAL_CONSTRUCTOR: |
| 955 break; | 954 break; |
| 956 } | 955 } |
| 957 throw new UnsupportedError("Unexpected element kind '${elementKind}."); | 956 throw new UnsupportedError("Unexpected element kind '${elementKind}."); |
| 958 } | 957 } |
| 959 } | 958 } |
| OLD | NEW |