Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: pkg/analyzer/lib/source/sdk_ext.dart

Issue 1245263002: Actual URI support for package URI resolution. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge master (tk2). Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 source.sdk_ext; 5 library 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 /// Return the path mapping for [libName] or null if there is none. 44 /// Return the path mapping for [libName] or null if there is none.
45 String operator[](String libName) => _urlMappings[libName]; 45 String operator[](String libName) => _urlMappings[libName];
46 46
47 /// Programmatically add a new SDK extension given a JSON description 47 /// Programmatically add a new SDK extension given a JSON description
48 /// ([sdkExtJSON]) and a lib directory ([libDir]). 48 /// ([sdkExtJSON]) and a lib directory ([libDir]).
49 void addSdkExt(String sdkExtJSON, Folder libDir) { 49 void addSdkExt(String sdkExtJSON, Folder libDir) {
50 _processSdkExt(sdkExtJSON, libDir); 50 _processSdkExt(sdkExtJSON, libDir);
51 } 51 }
52 52
53 @override 53 @override
54 Source resolveAbsolute(Uri importUri) { 54 Source resolveAbsolute(Uri importUri, [Uri actualUri]) {
55 String libraryName = _libraryName(importUri); 55 String libraryName = _libraryName(importUri);
56 String partPath = _partPath(importUri); 56 String partPath = _partPath(importUri);
57 // Lookup library name in mappings. 57 // Lookup library name in mappings.
58 String mapping = _urlMappings[libraryName]; 58 String mapping = _urlMappings[libraryName];
59 if (mapping == null) { 59 if (mapping == null) {
60 // Not found. 60 // Not found.
61 return null; 61 return null;
62 } 62 }
63 // This mapping points to the main entry file of the sdk extension. 63 // This mapping points to the main entry file of the sdk extension.
64 Uri libraryEntry = new Uri.file(mapping); 64 Uri libraryEntry = new Uri.file(mapping);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 /// Resolve a 'part' statement inside an sdk extension. 167 /// Resolve a 'part' statement inside an sdk extension.
168 Source _resolvePart(Uri libraryEntry, String partPath, Uri importUri) { 168 Source _resolvePart(Uri libraryEntry, String partPath, Uri importUri) {
169 // Library part. 169 // Library part.
170 var directory = pathos.dirname(libraryEntry.path); 170 var directory = pathos.dirname(libraryEntry.path);
171 var partUri = new Uri.file(pathos.join(directory, partPath)); 171 var partUri = new Uri.file(pathos.join(directory, partPath));
172 assert(partUri.isAbsolute); 172 assert(partUri.isAbsolute);
173 JavaFile javaFile = new JavaFile.fromUri(partUri); 173 JavaFile javaFile = new JavaFile.fromUri(partUri);
174 return new FileBasedSource(javaFile, importUri); 174 return new FileBasedSource(javaFile, importUri);
175 } 175 }
176 } 176 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/source/package_map_resolver.dart ('k') | pkg/analyzer/lib/src/generated/source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698