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

Side by Side Diff: lib/src/context.dart

Issue 883133002: path: Fix some analyzer hints. (Closed) Base URL: git@github.com:dart-lang/path@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/parsed_path.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 path.context; 5 library path.context;
6 6
7 import 'internal_style.dart'; 7 import 'internal_style.dart';
8 import 'style.dart'; 8 import 'style.dart';
9 import 'parsed_path.dart'; 9 import 'parsed_path.dart';
10 import 'path_exception.dart'; 10 import 'path_exception.dart';
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 /// context.prettyUri('file:///root/path'); // -> 'file:///root/path' 511 /// context.prettyUri('file:///root/path'); // -> 'file:///root/path'
512 String prettyUri(uri) { 512 String prettyUri(uri) {
513 if (uri is String) uri = Uri.parse(uri); 513 if (uri is String) uri = Uri.parse(uri);
514 if (uri.scheme == 'file' && style == Style.url) return uri.toString(); 514 if (uri.scheme == 'file' && style == Style.url) return uri.toString();
515 if (uri.scheme != 'file' && uri.scheme != '' && style != Style.url) { 515 if (uri.scheme != 'file' && uri.scheme != '' && style != Style.url) {
516 return uri.toString(); 516 return uri.toString();
517 } 517 }
518 518
519 var path = normalize(fromUri(uri)); 519 var path = normalize(fromUri(uri));
520 var rel = relative(path); 520 var rel = relative(path);
521 var components = split(rel);
522 521
523 // Only return a relative path if it's actually shorter than the absolute 522 // Only return a relative path if it's actually shorter than the absolute
524 // path. This avoids ugly things like long "../" chains to get to the root 523 // path. This avoids ugly things like long "../" chains to get to the root
525 // and then go back down. 524 // and then go back down.
526 return split(rel).length > split(path).length ? path : rel; 525 return split(rel).length > split(path).length ? path : rel;
527 } 526 }
528 527
529 ParsedPath _parse(String path) => new ParsedPath.parse(path, style); 528 ParsedPath _parse(String path) => new ParsedPath.parse(path, style);
530 } 529 }
531 530
(...skipping 12 matching lines...) Expand all
544 // Show the arguments. 543 // Show the arguments.
545 var message = new StringBuffer(); 544 var message = new StringBuffer();
546 message.write("$method("); 545 message.write("$method(");
547 message.write(args.take(numArgs) 546 message.write(args.take(numArgs)
548 .map((arg) => arg == null ? "null" : '"$arg"') 547 .map((arg) => arg == null ? "null" : '"$arg"')
549 .join(", ")); 548 .join(", "));
550 message.write("): part ${i - 1} was null, but part $i was not."); 549 message.write("): part ${i - 1} was null, but part $i was not.");
551 throw new ArgumentError(message.toString()); 550 throw new ArgumentError(message.toString());
552 } 551 }
553 } 552 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/parsed_path.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698