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

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

Issue 422973002: Move PackageMapUriResolver into analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 resolver.package; 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 9
10 10
11 /** 11 /**
12 * A [UriResolver] implementation for the `package:` scheme that uses a map of 12 * A [UriResolver] implementation for the `package:` scheme that uses a map of
13 * package names to their directories. 13 * package names to their directories.
14 */ 14 */
15 class PackageMapUriResolver extends UriResolver { 15 class PackageMapUriResolver extends UriResolver {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Resource result = packageDir.getChild(relPath); 74 Resource result = packageDir.getChild(relPath);
75 if (result is File && result.exists) { 75 if (result is File && result.exists) {
76 return result.createSource(UriKind.PACKAGE_URI); 76 return result.createSource(UriKind.PACKAGE_URI);
77 } 77 }
78 } 78 }
79 } 79 }
80 } 80 }
81 // Return a NonExistingSource instance. 81 // Return a NonExistingSource instance.
82 // This helps provide more meaningful error messages to users 82 // This helps provide more meaningful error messages to users
83 // (a missing file error, as opposed to an invalid URI error). 83 // (a missing file error, as opposed to an invalid URI error).
84 // TODO(scheglov) move NonExistingSource to "source.dart"
85 return new NonExistingSource(uri.toString(), UriKind.PACKAGE_URI); 84 return new NonExistingSource(uri.toString(), UriKind.PACKAGE_URI);
86 } 85 }
87 86
88 /** 87 /**
89 * Returns `true` if [uri] is a `package` URI. 88 * Returns `true` if [uri] is a `package` URI.
90 */ 89 */
91 static bool isPackageUri(Uri uri) { 90 static bool isPackageUri(Uri uri) {
92 return uri.scheme == PACKAGE_SCHEME; 91 return uri.scheme == PACKAGE_SCHEME;
93 } 92 }
94 } 93 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/test_all.dart ('k') | pkg/analyzer/test/source/package_map_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698