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

Side by Side Diff: pkg/front_end/lib/src/fasta/util/relativize.dart

Issue 2708893002: fasta: Cache relativizeUri(fileUri) on LibraryBuilder and ClassBuilder (or rather it's base class) (Closed)
Patch Set: Reorder import Created 3 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
OLDNEW
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698