| 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 analyzer.source.sdk_ext; | 5 library analyzer.source.sdk_ext; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 import 'dart:core' hide Resource; | 8 import 'dart:core' hide Resource; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 SdkExtUriResolver(Map<String, List<Folder>> packageMap) { | 36 SdkExtUriResolver(Map<String, List<Folder>> packageMap) { |
| 37 if (packageMap == null) { | 37 if (packageMap == null) { |
| 38 return; | 38 return; |
| 39 } | 39 } |
| 40 packageMap.forEach(_processPackage); | 40 packageMap.forEach(_processPackage); |
| 41 } | 41 } |
| 42 | 42 |
| 43 /// Number of sdk extensions. | 43 /// Number of sdk extensions. |
| 44 int get length => _urlMappings.length; | 44 int get length => _urlMappings.length; |
| 45 | 45 |
| 46 /** |
| 47 * Return a table mapping the names of extensions to the paths where those |
| 48 * extensions can be found. |
| 49 */ |
| 50 Map<String, String> get urlMappings => |
| 51 new Map<String, String>.from(_urlMappings); |
| 52 |
| 46 /// Return the path mapping for [libName] or null if there is none. | 53 /// Return the path mapping for [libName] or null if there is none. |
| 47 String operator [](String libName) => _urlMappings[libName]; | 54 String operator [](String libName) => _urlMappings[libName]; |
| 48 | 55 |
| 49 /// Programmatically add a new SDK extension given a JSON description | 56 /// Programmatically add a new SDK extension given a JSON description |
| 50 /// ([sdkExtJSON]) and a lib directory ([libDir]). | 57 /// ([sdkExtJSON]) and a lib directory ([libDir]). |
| 51 void addSdkExt(String sdkExtJSON, Folder libDir) { | 58 void addSdkExt(String sdkExtJSON, Folder libDir) { |
| 52 _processSdkExt(sdkExtJSON, libDir); | 59 _processSdkExt(sdkExtJSON, libDir); |
| 53 } | 60 } |
| 54 | 61 |
| 55 @override | 62 @override |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 /// Resolve a 'part' statement inside an sdk extension. | 183 /// Resolve a 'part' statement inside an sdk extension. |
| 177 Source _resolvePart(Uri libraryEntry, String partPath, Uri importUri) { | 184 Source _resolvePart(Uri libraryEntry, String partPath, Uri importUri) { |
| 178 // Library part. | 185 // Library part. |
| 179 var directory = pathos.dirname(libraryEntry.path); | 186 var directory = pathos.dirname(libraryEntry.path); |
| 180 var partUri = new Uri.file(pathos.join(directory, partPath)); | 187 var partUri = new Uri.file(pathos.join(directory, partPath)); |
| 181 assert(partUri.isAbsolute); | 188 assert(partUri.isAbsolute); |
| 182 JavaFile javaFile = new JavaFile.fromUri(partUri); | 189 JavaFile javaFile = new JavaFile.fromUri(partUri); |
| 183 return new FileBasedSource(javaFile, importUri); | 190 return new FileBasedSource(javaFile, importUri); |
| 184 } | 191 } |
| 185 } | 192 } |
| OLD | NEW |