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

Unified Diff: pkg/code_transformers/lib/src/resolver_impl.dart

Issue 428303004: Breaking changes in 'analyzer' package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/code_transformers/lib/src/resolver_impl.dart
diff --git a/pkg/code_transformers/lib/src/resolver_impl.dart b/pkg/code_transformers/lib/src/resolver_impl.dart
index 52f803326eb9375b37ebeb897388ca7929c2346e..ededdff17922a33a3ff9eb2ef6b674c54aa34b11 100644
--- a/pkg/code_transformers/lib/src/resolver_impl.dart
+++ b/pkg/code_transformers/lib/src/resolver_impl.dart
@@ -116,7 +116,9 @@ class ResolverImpl implements Resolver {
visiting.add(transform.readInputAsString(assetId).then((contents) {
var source = sources[assetId];
if (source == null) {
- source = new _AssetBasedSource(assetId, this);
+ // TODO(scheglov) how to get Uri here?
Siggi Cherem (dart-lang) 2014/08/04 22:43:55 You might be able to basically use the logic we ha
+ Uri uri = null;
+ source = new _AssetBasedSource(assetId, this, uri);
sources[assetId] = source;
}
source.updateDependencies(contents);
@@ -298,6 +300,9 @@ class _AssetBasedSource extends Source {
/// The resolver this is being used in.
final ResolverImpl _resolver;
+ /// The URI from which this source was originally derived.
+ final Uri uri;
+
/// Cache of dependent asset IDs, to avoid re-parsing the AST.
Iterable<AssetId> _dependentAssets;
@@ -307,7 +312,7 @@ class _AssetBasedSource extends Source {
/// The file contents.
String _contents;
- _AssetBasedSource(this.assetId, this._resolver);
+ _AssetBasedSource(this.assetId, this._resolver, this.uri);
/// Update the dependencies of this source. This parses [contents] but avoids
/// any analyzer resolution.
@@ -377,7 +382,7 @@ class _AssetBasedSource extends Source {
bool get isInSystemLibrary => false;
- Source resolveRelative(Uri relativeUri) {
+ Uri resolveRelative(Uri relativeUri) {
var id = _resolve(assetId, relativeUri.toString(), _logger, null);
if (id == null) return null;
@@ -386,7 +391,7 @@ class _AssetBasedSource extends Source {
if (source == null) {
_logger.error('Could not load asset $id');
}
- return source;
+ return source.uri;
}
/// For logging errors.
@@ -431,7 +436,7 @@ class _AssetUriResolver implements UriResolver {
// Analyzer expects that sources which are referenced but do not exist yet
// still exist, so just make an empty source.
if (source == null) {
- source = new _AssetBasedSource(assetId, _resolver);
+ source = new _AssetBasedSource(assetId, _resolver, uri);
Siggi Cherem (dart-lang) 2014/08/04 22:43:55 if this is intended to be the resolved uri, then I
_resolver.sources[assetId] = source;
}
return source;
« pkg/code_transformers/lib/src/dart_sdk.dart ('K') | « pkg/code_transformers/lib/src/dart_sdk.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698