Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 fasta.util.relativize; | 5 library fasta.util.relativize; |
| 6 | 6 |
| 7 // TODO(ahe): Move more advanced version from dart2js here. | 7 // TODO(ahe): Move more advanced version from dart2js here. |
| 8 | 8 |
| 9 String relativizeUri(Uri uri, {Uri base}) { | 9 String relativizeUri(Uri uri, {Uri base}) { |
| 10 if (uri == null) return null; | 10 if (uri == null) return null; |
| 11 base ??= Uri.base; | 11 base ??= Uri.base; |
| 12 String result = "$uri"; | 12 String result = uri.toString(); |
|
ahe
2017/02/21 14:15:23
I prefer the existing style, and I know dart2js ge
| |
| 13 return result.startsWith("$base") ? result.substring("$base".length) : result; | 13 final prefix = base.toString(); |
|
ahe
2017/02/21 14:15:22
String prefix = "$base";
kustermann
2017/02/22 14:40:28
I changed it because I saw some interpolate instru
ahe
2017/02/22 14:50:06
Let's not forget this. I'm pretty sure we have a b
| |
| 14 return result.startsWith(prefix) ? result.substring(prefix.length) : result; | |
| 14 } | 15 } |
| OLD | NEW |