| OLD | NEW |
| 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 resolver.package; |
| 6 | 6 |
| 7 import 'dart:collection'; |
| 8 |
| 7 import 'package:analysis_server/src/resource.dart'; | 9 import 'package:analysis_server/src/resource.dart'; |
| 8 import 'package:analyzer/src/generated/source_io.dart'; | 10 import 'package:analyzer/src/generated/source_io.dart'; |
| 9 | 11 |
| 10 | 12 |
| 11 /** | 13 /** |
| 12 * A [UriResolver] implementation for the `package:` scheme that uses a map of | 14 * A [UriResolver] implementation for the `package:` scheme that uses a map of |
| 13 * package names to their directories. | 15 * package names to their directories. |
| 14 */ | 16 */ |
| 15 class PackageMapUriResolver extends UriResolver { | 17 class PackageMapUriResolver extends UriResolver { |
| 16 /** | 18 /** |
| 17 * The name of the `package` scheme. | 19 * The name of the `package` scheme. |
| 18 */ | 20 */ |
| 19 static const String PACKAGE_SCHEME = "package"; | 21 static const String PACKAGE_SCHEME = "package"; |
| 20 | 22 |
| 21 /** | 23 /** |
| 22 * A table mapping package names to the path of the directories containing | 24 * A table mapping package names to the path of the directories containing |
| 23 * the package. | 25 * the package. |
| 24 */ | 26 */ |
| 25 final Map<String, List<Folder>> packageMap; | 27 final HashMap<String, List<Folder>> packageMap; |
| 26 | 28 |
| 27 /** | 29 /** |
| 28 * The [ResourceProvider] for this resolver. | 30 * The [ResourceProvider] for this resolver. |
| 29 */ | 31 */ |
| 30 final ResourceProvider resourceProvider; | 32 final ResourceProvider resourceProvider; |
| 31 | 33 |
| 32 /** | 34 /** |
| 33 * Create a new [PackageMapUriResolver]. | 35 * Create a new [PackageMapUriResolver]. |
| 34 * | 36 * |
| 35 * [packageMap] is a table mapping package names to the paths of the | 37 * [packageMap] is a table mapping package names to the paths of the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 return new NonExistingSource(uri.toString(), UriKind.PACKAGE_URI); | 87 return new NonExistingSource(uri.toString(), UriKind.PACKAGE_URI); |
| 86 } | 88 } |
| 87 | 89 |
| 88 /** | 90 /** |
| 89 * Returns `true` if [uri] is a `package` URI. | 91 * Returns `true` if [uri] is a `package` URI. |
| 90 */ | 92 */ |
| 91 static bool isPackageUri(Uri uri) { | 93 static bool isPackageUri(Uri uri) { |
| 92 return uri.scheme == PACKAGE_SCHEME; | 94 return uri.scheme == PACKAGE_SCHEME; |
| 93 } | 95 } |
| 94 } | 96 } |
| OLD | NEW |