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

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

Issue 914373004: Use package: URIs for files in lib (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test and fixed URI usage Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.package_map_resolver; 5 library source.package_map_resolver;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 import 'package:analyzer/src/util/asserts.dart' as asserts; 9 import 'package:analyzer/src/util/asserts.dart' as asserts;
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 @override 77 @override
78 Uri restoreAbsolute(Source source) { 78 Uri restoreAbsolute(Source source) {
79 String sourcePath = source.fullName; 79 String sourcePath = source.fullName;
80 for (String pkgName in packageMap.keys) { 80 for (String pkgName in packageMap.keys) {
81 List<Folder> pkgFolders = packageMap[pkgName]; 81 List<Folder> pkgFolders = packageMap[pkgName];
82 for (Folder pkgFolder in pkgFolders) { 82 for (Folder pkgFolder in pkgFolders) {
83 String pkgFolderPath = pkgFolder.path; 83 String pkgFolderPath = pkgFolder.path;
84 if (sourcePath.startsWith(pkgFolderPath)) { 84 if (sourcePath.startsWith(pkgFolderPath)) {
85 String relPath = sourcePath.substring(pkgFolderPath.length); 85 String relPath = sourcePath.substring(pkgFolderPath.length);
86 return new Uri(path: '$PACKAGE_SCHEME:$pkgName$relPath'); 86 return Uri.parse('$PACKAGE_SCHEME:$pkgName$relPath');
87 } 87 }
88 } 88 }
89 } 89 }
90 return null; 90 return null;
91 } 91 }
92 92
93 /** 93 /**
94 * Returns `true` if [uri] is a `package` URI. 94 * Returns `true` if [uri] is a `package` URI.
95 */ 95 */
96 static bool isPackageUri(Uri uri) { 96 static bool isPackageUri(Uri uri) {
97 return uri.scheme == PACKAGE_SCHEME; 97 return uri.scheme == PACKAGE_SCHEME;
98 } 98 }
99 } 99 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698