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

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

Issue 897593005: Adds a repeatable --url_mapping flag to dartanalyzer (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/source.dart
===================================================================
--- pkg/analyzer/lib/src/generated/source.dart (revision 43787)
+++ pkg/analyzer/lib/src/generated/source.dart (working copy)
@@ -17,7 +17,9 @@
import 'engine.dart';
import 'java_core.dart';
import 'java_engine.dart';
+import 'java_io.dart' show JavaFile;
import 'sdk.dart' show DartSdk;
+import 'source_io.dart' show FileBasedSource;
/**
* A function that is used to handle [ContentCache] entries.
@@ -165,6 +167,24 @@
static bool isDartUri(Uri uri) => DART_SCHEME == uri.scheme;
}
+class CustomUriResolver extends UriResolver {
+ final Map<String, String> _urlMappings;
+
+ CustomUriResolver(this._urlMappings);
+
+ @override
+ Source resolveAbsolute(Uri uri) {
+ String mapping = _urlMappings[uri.toString()];
+ if (mapping == null) return null;
+
+ Uri fileUri = new Uri.file(mapping);
+ if (!fileUri.isAbsolute) return null;
+
+ JavaFile javaFile = new JavaFile.fromUri(fileUri);
+ return new FileBasedSource.con1(javaFile);
+ }
+}
+
/**
* Instances of the class `LineInfo` encapsulate information about line and column information
* within a source file.
« no previous file with comments | « pkg/analyzer/lib/src/analyzer_impl.dart ('k') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698