| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.test.src.summary.summarize_elements_test; | 5 library analyzer.test.src.summary.summarize_elements_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; | 7 import 'package:analyzer/dart/element/element.dart'; |
| 8 import 'package:analyzer/src/generated/engine.dart'; | 8 import 'package:analyzer/src/generated/engine.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:analyzer/src/generated/source_io.dart'; | 10 import 'package:analyzer/src/generated/source_io.dart'; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 * Serialize the given [library] element, then deserialize it and store the | 86 * Serialize the given [library] element, then deserialize it and store the |
| 87 * resulting summary in [linked] and [unlinkedUnits]. | 87 * resulting summary in [linked] and [unlinkedUnits]. |
| 88 */ | 88 */ |
| 89 void serializeLibraryElement(LibraryElement library) { | 89 void serializeLibraryElement(LibraryElement library) { |
| 90 summarize_elements.LibrarySerializationResult serializedLib = | 90 summarize_elements.LibrarySerializationResult serializedLib = |
| 91 summarize_elements.serializeLibrary( | 91 summarize_elements.serializeLibrary( |
| 92 library, typeProvider, analysisContext.analysisOptions.strongMode); | 92 library, typeProvider, analysisContext.analysisOptions.strongMode); |
| 93 { | 93 { |
| 94 List<int> buffer = serializedLib.linked.toBuffer(); | 94 List<int> buffer = serializedLib.linked.toBuffer(); |
| 95 linked = new LinkedLibrary.fromBuffer(buffer); | 95 linked = new LinkedLibrary.fromBuffer(buffer); |
| 96 validateLinkedLibrary(linked); |
| 96 } | 97 } |
| 97 unlinkedUnits = serializedLib.unlinkedUnits.map((UnlinkedUnitBuilder b) { | 98 unlinkedUnits = serializedLib.unlinkedUnits.map((UnlinkedUnitBuilder b) { |
| 98 List<int> buffer = b.toBuffer(); | 99 List<int> buffer = b.toBuffer(); |
| 99 return new UnlinkedUnit.fromBuffer(buffer); | 100 return new UnlinkedUnit.fromBuffer(buffer); |
| 100 }).toList(); | 101 }).toList(); |
| 101 unitUris = serializedLib.unitUris; | 102 unitUris = serializedLib.unitUris; |
| 102 } | 103 } |
| 103 | 104 |
| 104 @override | 105 @override |
| 105 void serializeLibraryText(String text, {bool allowErrors: false}) { | 106 void serializeLibraryText(String text, {bool allowErrors: false}) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 } else { | 148 } else { |
| 148 UnlinkedPublicNamespace namespace = | 149 UnlinkedPublicNamespace namespace = |
| 149 computePublicNamespaceFromText(text, source); | 150 computePublicNamespaceFromText(text, source); |
| 150 expect(canonicalize(namespace), | 151 expect(canonicalize(namespace), |
| 151 canonicalize(unlinkedUnits[i].publicNamespace), | 152 canonicalize(unlinkedUnits[i].publicNamespace), |
| 152 reason: 'publicNamespace(${unitUris[i]})'); | 153 reason: 'publicNamespace(${unitUris[i]})'); |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 } | 156 } |
| 156 } | 157 } |
| OLD | NEW |