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

Side by Side Diff: pkg/front_end/lib/src/base/resolve_relative_uri.dart

Issue 2668553002: Move resolveRelativeUri into front_end. (Closed)
Patch Set: 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /**
6 * Resolve the [containedUri] against [baseUri] using Dart rules.
7 *
8 * This function behaves similarly to [Uri.resolveUri], except that it properly
9 * handles situations like the following:
10 *
11 * resolveRelativeUri(dart:core, bool.dart) -> dart:core/bool.dart
12 * resolveRelativeUri(package:a/b.dart, ../c.dart) -> package:a/c.dart
13 */
14 Uri resolveRelativeUri(Uri baseUri, Uri containedUri) {
15 if (containedUri.isAbsolute) {
16 return containedUri;
17 }
18 String scheme = baseUri.scheme;
19 // dart:core => dart:core/core.dart
20 if (scheme == 'dart') {
21 String part = baseUri.path;
22 if (part.indexOf('/') < 0) {
23 baseUri = Uri.parse('$scheme:$part/$part.dart');
24 }
25 }
26 return baseUri.resolveUri(containedUri);
27 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/utilities_dart.dart ('k') | pkg/front_end/lib/src/incremental_resolved_ast_generator_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698