| Index: pkg/analyzer/lib/src/generated/utilities_dart.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/utilities_dart.dart b/pkg/analyzer/lib/src/generated/utilities_dart.dart
|
| index 41b7d7c5cbc4379f2654406de75b51b6f4120117..63c6a15cd2977fdfef6c1de7986c252dd2780a3b 100644
|
| --- a/pkg/analyzer/lib/src/generated/utilities_dart.dart
|
| +++ b/pkg/analyzer/lib/src/generated/utilities_dart.dart
|
| @@ -8,6 +8,42 @@ import 'package:analyzer/dart/ast/ast.dart' show AnnotatedNode, Comment;
|
| import 'package:analyzer/dart/ast/token.dart' show Token;
|
| import 'package:analyzer/src/dart/element/element.dart' show ElementImpl;
|
| import 'package:analyzer/src/generated/java_core.dart';
|
| +import 'package:analyzer/src/generated/java_engine.dart';
|
| +import 'package:analyzer/src/generated/source.dart';
|
| +
|
| +/**
|
| + * Resolve the [containedUri] against [baseUri] using Dart rules.
|
| + *
|
| + * This function behaves similarly to [Uri.resolveUri], except that it properly
|
| + * handles situations like the following:
|
| + *
|
| + * resolveRelativeUri(dart:core, bool.dart) -> dart:core/bool.dart
|
| + * resolveRelativeUri(package:a/b.dart, ../c.dart) -> package:a/c.dart
|
| + */
|
| +Uri resolveRelativeUri(Uri baseUri, Uri containedUri) {
|
| + Uri origBaseUri = baseUri;
|
| + try {
|
| + bool isOpaque = baseUri.isAbsolute && !baseUri.path.startsWith('/');
|
| + if (isOpaque) {
|
| + String scheme = baseUri.scheme;
|
| + String part = baseUri.path;
|
| + if (scheme == DartUriResolver.DART_SCHEME && part.indexOf('/') < 0) {
|
| + part = "$part/$part.dart";
|
| + }
|
| + baseUri = parseUriWithException("$scheme:/$part");
|
| + }
|
| + Uri result = baseUri.resolveUri(containedUri);
|
| + if (isOpaque) {
|
| + result =
|
| + parseUriWithException("${result.scheme}:${result.path.substring(1)}");
|
| + }
|
| + return result;
|
| + } catch (exception, stackTrace) {
|
| + throw new AnalysisException(
|
| + "Could not resolve URI ($containedUri) relative to source ($origBaseUri)",
|
| + new CaughtException(exception, stackTrace));
|
| + }
|
| +}
|
|
|
| /**
|
| * If the given [node] has a documentation comment, remember its content
|
|
|