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

Unified Diff: pkg/barback/lib/src/asset_id.dart

Issue 22685006: Better handling of asset collisions in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/asset_id.dart
diff --git a/pkg/barback/lib/src/asset_id.dart b/pkg/barback/lib/src/asset_id.dart
index d514a76d77d666cdf6ebec4184d2ec22ec2efda7..d9cef3261f856ed81abbbe82455c53a74e45c853 100644
--- a/pkg/barback/lib/src/asset_id.dart
+++ b/pkg/barback/lib/src/asset_id.dart
@@ -13,7 +13,7 @@ import 'package:path/path.dart' as pathos;
final _posix = new pathos.Builder(style: pathos.Style.posix);
/// Identifies an asset within a package.
-class AssetId {
+class AssetId implements Comparable<AssetId> {
/// The name of the package containing this asset.
final String package;
@@ -73,6 +73,12 @@ class AssetId {
int get hashCode => package.hashCode ^ path.hashCode;
+ int compareTo(AssetId other) {
+ var packageComp = package.compareTo(other.package);
+ if (packageComp != 0) return packageComp;
+ return path.compareTo(other.path);
+ }
+
/// Returns a new [AssetId] with the same [package] as this one and with the
/// [path] extended to include [extension].
AssetId addExtension(String extension) =>
« no previous file with comments | « no previous file | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698