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

Unified Diff: pkg/analyzer/lib/src/generated/source_io.dart

Issue 1831133005: Consolidate duplicate code for resloving URIs. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Sort Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/generated/source_io.dart
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index b27e3a195e8764539925840efe34b612d6d54ab3..811a048ba81a6af2df9f3632999e7a2e2c15a4d1 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -11,6 +11,7 @@ import 'package:analyzer/src/generated/java_core.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/java_io.dart';
import 'package:analyzer/src/generated/source.dart';
+import 'package:analyzer/src/generated/utilities_dart.dart';
export 'package:analyzer/src/generated/source.dart';
@@ -247,32 +248,6 @@ class FileBasedSource extends Source {
bool exists() => file.isFile();
@override
- Uri resolveRelativeUri(Uri containedUri) {
- try {
- Uri baseUri = uri;
- bool isOpaque = uri.isAbsolute && !uri.path.startsWith('/');
- if (isOpaque) {
- String scheme = uri.scheme;
- String part = uri.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 ($uri)",
- new CaughtException(exception, stackTrace));
- }
- }
-
- @override
String toString() {
if (file == null) {
return "<unknown source>";

Powered by Google App Engine
This is Rietveld 408576698