| 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 import 'common.dart'; | 5 import 'common.dart'; |
| 6 import 'elements/elements.dart' show LibraryElement; | 6 import 'elements/elements.dart' show LibraryElement; |
| 7 import 'util/emptyset.dart'; | 7 import 'util/emptyset.dart'; |
| 8 | 8 |
| 9 /// API used by the library loader to translate internal SDK URIs into file | 9 /// API used by the library loader to translate internal SDK URIs into file |
| 10 /// system readable URIs. | 10 /// system readable URIs. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 if (location == null) { | 108 if (location == null) { |
| 109 _reporter.reportErrorMessage(spannable, MessageKind.LIBRARY_NOT_FOUND, | 109 _reporter.reportErrorMessage(spannable, MessageKind.LIBRARY_NOT_FOUND, |
| 110 {'resolvedUri': resolvedUri}); | 110 {'resolvedUri': resolvedUri}); |
| 111 return null; | 111 return null; |
| 112 } | 112 } |
| 113 | 113 |
| 114 if (resolvedUri.path.startsWith('_')) { | 114 if (resolvedUri.path.startsWith('_')) { |
| 115 bool allowInternalLibraryAccess = importingLibrary != null && | 115 bool allowInternalLibraryAccess = importingLibrary != null && |
| 116 (importingLibrary.isPlatformLibrary || | 116 (importingLibrary.isPlatformLibrary || |
| 117 importingLibrary.isPatch || | 117 importingLibrary.isPatch || |
| 118 // The memory scheme is specifically for unit tests that use the |
| 119 // in-memory compiler. |
| 120 importingLibrary.canonicalUri.scheme == 'memory' || |
| 118 importingLibrary.canonicalUri.path | 121 importingLibrary.canonicalUri.path |
| 119 .contains('sdk/tests/compiler/dart2js_native')); | 122 .contains('sdk/tests/compiler/dart2js_native')); |
| 120 | 123 |
| 121 if (!allowInternalLibraryAccess) { | 124 if (!allowInternalLibraryAccess) { |
| 122 if (importingLibrary != null) { | 125 if (importingLibrary != null) { |
| 123 _reporter.reportErrorMessage( | 126 _reporter.reportErrorMessage( |
| 124 spannable, MessageKind.INTERNAL_LIBRARY_FROM, { | 127 spannable, MessageKind.INTERNAL_LIBRARY_FROM, { |
| 125 'resolvedUri': resolvedUri, | 128 'resolvedUri': resolvedUri, |
| 126 'importingUri': importingLibrary.canonicalUri | 129 'importingUri': importingLibrary.canonicalUri |
| 127 }); | 130 }); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 150 } | 153 } |
| 151 | 154 |
| 152 void registerDisallowedLibraryUse(Uri uri) { | 155 void registerDisallowedLibraryUse(Uri uri) { |
| 153 disallowedLibraryUris.add(uri); | 156 disallowedLibraryUris.add(uri); |
| 154 } | 157 } |
| 155 | 158 |
| 156 Uri lookupLibraryUri(String libraryName) { | 159 Uri lookupLibraryUri(String libraryName) { |
| 157 return _sdkLibraries[libraryName]; | 160 return _sdkLibraries[libraryName]; |
| 158 } | 161 } |
| 159 } | 162 } |
| OLD | NEW |