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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:pub_semver/pub_semver.dart'; | 7 import 'package:pub_semver/pub_semver.dart'; |
8 | 8 |
9 import '../package.dart'; | 9 import '../package.dart'; |
10 import '../pubspec.dart'; | 10 import '../pubspec.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 /// Two unknown sources are the same if their names are the same. | 28 /// Two unknown sources are the same if their names are the same. |
29 bool operator==(other) => | 29 bool operator==(other) => |
30 other is UnknownSource && | 30 other is UnknownSource && |
31 other.name == name; | 31 other.name == name; |
32 | 32 |
33 int get hashCode => name.hashCode; | 33 int get hashCode => name.hashCode; |
34 | 34 |
35 bool descriptionsEqual(description1, description2) => | 35 bool descriptionsEqual(description1, description2) => |
36 description1 == description2; | 36 description1 == description2; |
37 | 37 |
| 38 int hashDescription(description) => description.hashCode; |
| 39 |
38 PackageRef parseRef(String name, description, {String containingPath}) => | 40 PackageRef parseRef(String name, description, {String containingPath}) => |
39 new PackageRef(name, this.name, description); | 41 new PackageRef(name, this, description); |
40 | 42 |
41 PackageId parseId(String name, Version version, description) => | 43 PackageId parseId(String name, Version version, description) => |
42 new PackageId(name, this.name, version, description); | 44 new PackageId(name, this, version, description); |
43 } | 45 } |
44 | 46 |
45 class _BoundUnknownSource extends BoundSource { | 47 class _BoundUnknownSource extends BoundSource { |
46 final UnknownSource source; | 48 final UnknownSource source; |
47 | 49 |
48 final SystemCache systemCache; | 50 final SystemCache systemCache; |
49 | 51 |
50 _BoundUnknownSource(this.source, this.systemCache); | 52 _BoundUnknownSource(this.source, this.systemCache); |
51 | 53 |
52 Future<List<PackageId>> doGetVersions(PackageRef ref) => | 54 Future<List<PackageId>> doGetVersions(PackageRef ref) => |
53 throw new UnsupportedError( | 55 throw new UnsupportedError( |
54 "Cannot get package versions from unknown source '${source.name}'."); | 56 "Cannot get package versions from unknown source '${source.name}'."); |
55 | 57 |
56 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( | 58 Future<Pubspec> doDescribe(PackageId id) => throw new UnsupportedError( |
57 "Cannot describe a package from unknown source '${source.name}'."); | 59 "Cannot describe a package from unknown source '${source.name}'."); |
58 | 60 |
59 Future get(PackageId id, String symlink) => throw new UnsupportedError( | 61 Future get(PackageId id, String symlink) => throw new UnsupportedError( |
60 "Cannot get an unknown source '${source.name}'."); | 62 "Cannot get an unknown source '${source.name}'."); |
61 | 63 |
62 /// Returns the directory where this package can be found locally. | 64 /// Returns the directory where this package can be found locally. |
63 String getDirectory(PackageId id) => throw new UnsupportedError( | 65 String getDirectory(PackageId id) => throw new UnsupportedError( |
64 "Cannot find a package from an unknown source '${source.name}'."); | 66 "Cannot find a package from an unknown source '${source.name}'."); |
65 } | 67 } |
OLD | NEW |