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

Unified Diff: runtime/bin/path_impl.dart

Issue 10668041: Make Path implement (extend) Hashable, and make Path.append to an empty path work right. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests. Created 8 years, 6 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 | « runtime/bin/path.dart ('k') | tests/standalone/io/path_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/path_impl.dart
diff --git a/runtime/bin/path_impl.dart b/runtime/bin/path_impl.dart
index 9cdc3150f0d99f9ac2d2a9a25e7e659fe78b1f73..40b6aa7e095ececc5943a87dd5c7e11c1f6eb198 100644
--- a/runtime/bin/path_impl.dart
+++ b/runtime/bin/path_impl.dart
@@ -8,6 +8,8 @@ class _Path implements Path {
const _Path(String source) : _path = source;
_Path.fromNative(String source) : _path = _clean(source);
+ int hashCode() => _path.hashCode();
+
static String _clean(String source) {
switch (Platform.operatingSystem) {
case 'windows':
@@ -179,7 +181,9 @@ class _Path implements Path {
}
Path append(String finalSegment) {
- if (hasTrailingSeparator) {
+ if (isEmpty) {
+ return new Path(finalSegment);
+ } else if (hasTrailingSeparator) {
return new Path('$_path$finalSegment');
} else {
return new Path('$_path/$finalSegment');
« no previous file with comments | « runtime/bin/path.dart ('k') | tests/standalone/io/path_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698