| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 String absoluteUri = resolveToAbsoluteUri(library, relativeUri); | 68 String absoluteUri = resolveToAbsoluteUri(library, relativeUri); |
| 69 UnlinkedUnit unit = uriToUnit[absoluteUri]; | 69 UnlinkedUnit unit = uriToUnit[absoluteUri]; |
| 70 if (unit == null) { | 70 if (unit == null) { |
| 71 fail('Prelinker unexpectedly requested unit for "$relativeUri"' | 71 fail('Prelinker unexpectedly requested unit for "$relativeUri"' |
| 72 ' (resolves to "$absoluteUri").'); | 72 ' (resolves to "$absoluteUri").'); |
| 73 } | 73 } |
| 74 return unit; | 74 return unit; |
| 75 } | 75 } |
| 76 UnlinkedPublicNamespace getImport(String relativeUri) { | 76 UnlinkedPublicNamespace getImport(String relativeUri) { |
| 77 String absoluteUri = resolveToAbsoluteUri(library, relativeUri); | 77 String absoluteUri = resolveToAbsoluteUri(library, relativeUri); |
| 78 UnlinkedPublicNamespace namespace = sdkPublicNamespace[absoluteUri]; | 78 UnlinkedPublicNamespace namespace = SerializedMockSdk |
| 79 .instance.uriToUnlinkedUnit[absoluteUri]?.publicNamespace; |
| 79 if (namespace == null) { | 80 if (namespace == null) { |
| 80 namespace = uriToPublicNamespace[absoluteUri]; | 81 namespace = uriToPublicNamespace[absoluteUri]; |
| 81 } | 82 } |
| 82 if (namespace == null && !allowMissingFiles) { | 83 if (namespace == null && !allowMissingFiles) { |
| 83 fail('Prelinker unexpectedly requested namespace for "$relativeUri"' | 84 fail('Prelinker unexpectedly requested namespace for "$relativeUri"' |
| 84 ' (resolves to "$absoluteUri").' | 85 ' (resolves to "$absoluteUri").' |
| 85 ' Namespaces available: ${uriToPublicNamespace.keys}'); | 86 ' Namespaces available: ${uriToPublicNamespace.keys}'); |
| 86 } | 87 } |
| 87 return namespace; | 88 return namespace; |
| 88 } | 89 } |
| 89 linked = new LinkedLibrary.fromBuffer( | 90 linked = new LinkedLibrary.fromBuffer( |
| 90 prelink(unlinkedUnits[0], getPart, getImport).toBuffer()); | 91 prelink(unlinkedUnits[0], getPart, getImport).toBuffer()); |
| 91 validateLinkedLibrary(linked); | 92 validateLinkedLibrary(linked); |
| 92 } | 93 } |
| 93 } | 94 } |
| OLD | NEW |