| 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.prelinker_test; | 5 library analyzer.test.src.summary.prelinker_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/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
| 9 import 'package:analyzer/src/generated/source_io.dart'; | 9 import 'package:analyzer/src/generated/source_io.dart'; |
| 10 import 'package:analyzer/src/summary/idl.dart'; | 10 import 'package:analyzer/src/summary/idl.dart'; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 context.sourceFactory.resolveUri(library.source, relativeUri); | 52 context.sourceFactory.resolveUri(library.source, relativeUri); |
| 53 if (resolvedSource == null) { | 53 if (resolvedSource == null) { |
| 54 fail('Failed to resolve relative uri "$relativeUri"'); | 54 fail('Failed to resolve relative uri "$relativeUri"'); |
| 55 } | 55 } |
| 56 return resolvedSource.uri.toString(); | 56 return resolvedSource.uri.toString(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 @override | 59 @override |
| 60 void serializeLibraryElement(LibraryElement library) { | 60 void serializeLibraryElement(LibraryElement library) { |
| 61 super.serializeLibraryElement(library); | 61 super.serializeLibraryElement(library); |
| 62 uriToPublicNamespace[library.source.uri.toString()] = |
| 63 unlinkedUnits[0].publicNamespace; |
| 62 Map<String, UnlinkedUnit> uriToUnit = <String, UnlinkedUnit>{}; | 64 Map<String, UnlinkedUnit> uriToUnit = <String, UnlinkedUnit>{}; |
| 63 expect(unlinkedUnits.length, unitUris.length); | 65 expect(unlinkedUnits.length, unitUris.length); |
| 64 for (int i = 1; i < unlinkedUnits.length; i++) { | 66 for (int i = 1; i < unlinkedUnits.length; i++) { |
| 65 uriToUnit[unitUris[i]] = unlinkedUnits[i]; | 67 uriToUnit[unitUris[i]] = unlinkedUnits[i]; |
| 66 } | 68 } |
| 67 UnlinkedUnit getPart(String relativeUri) { | 69 UnlinkedUnit getPart(String relativeUri) { |
| 68 String absoluteUri = resolveToAbsoluteUri(library, relativeUri); | 70 String absoluteUri = resolveToAbsoluteUri(library, relativeUri); |
| 69 UnlinkedUnit unit = uriToUnit[absoluteUri]; | 71 UnlinkedUnit unit = uriToUnit[absoluteUri]; |
| 70 if (unit == null) { | 72 if (unit == null) { |
| 71 fail('Prelinker unexpectedly requested unit for "$relativeUri"' | 73 fail('Prelinker unexpectedly requested unit for "$relativeUri"' |
| (...skipping 13 matching lines...) Expand all Loading... |
| 85 ' (resolves to "$absoluteUri").' | 87 ' (resolves to "$absoluteUri").' |
| 86 ' Namespaces available: ${uriToPublicNamespace.keys}'); | 88 ' Namespaces available: ${uriToPublicNamespace.keys}'); |
| 87 } | 89 } |
| 88 return namespace; | 90 return namespace; |
| 89 } | 91 } |
| 90 linked = new LinkedLibrary.fromBuffer( | 92 linked = new LinkedLibrary.fromBuffer( |
| 91 prelink(unlinkedUnits[0], getPart, getImport).toBuffer()); | 93 prelink(unlinkedUnits[0], getPart, getImport).toBuffer()); |
| 92 validateLinkedLibrary(linked); | 94 validateLinkedLibrary(linked); |
| 93 } | 95 } |
| 94 } | 96 } |
| OLD | NEW |