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

Unified Diff: lib/build/import_crawler.dart

Issue 993423004: Fix normalization of relative paths inside of deep relative imports (Closed) Base URL: git@github.com:dart-lang/web-components.git@master
Patch Set: format Created 5 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
« no previous file with comments | « lib/build/html_import_annotation_recorder.dart ('k') | lib/build/import_inliner.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/build/import_crawler.dart
diff --git a/lib/build/import_crawler.dart b/lib/build/import_crawler.dart
index c655efc7aece41ee5fa0c9a46c2f402d50caa8b6..e1b6e48167fb4facdf2c794084d87cec806a1b0f 100644
--- a/lib/build/import_crawler.dart
+++ b/lib/build/import_crawler.dart
@@ -14,13 +14,16 @@ import 'messages.dart';
/// Information about an html import found in a document.
class ImportData {
+ /// The [AssetId] where the html import appeared.
+ final AssetId fromId;
+
/// The [Document] where the html import appeared.
final Document document;
/// The html import element itself.
final Element element;
- ImportData(this.document, this.element);
+ ImportData(this.document, this.element, {this.fromId});
}
/// A crawler for html imports.
@@ -45,18 +48,19 @@ class ImportCrawler {
var documents = new LinkedHashMap<AssetId, ImportData>();
var seen = new Set<AssetId>();
- Future doCrawl(AssetId assetId, [Element import, Document document]) {
+ Future doCrawl(AssetId assetId,
+ {Element import, Document document, AssetId from}) {
if (seen.contains(assetId)) return null;
seen.add(assetId);
Future crawlImports(Document document) {
var imports = document.querySelectorAll('link[rel="import"]');
- var done =
- Future.forEach(imports, (i) => doCrawl(_importId(assetId, i), i));
+ var done = Future.forEach(imports,
+ (i) => doCrawl(_importId(assetId, i), import: i, from: assetId));
// Add this document after its dependencies.
return done.then((_) {
- documents[assetId] = new ImportData(document, import);
+ documents[assetId] = new ImportData(document, import, fromId: from);
});
}
@@ -73,8 +77,8 @@ class ImportCrawler {
}
}
- return
- doCrawl(_primaryInputId, null, _primaryDocument).then((_) => documents);
+ return doCrawl(_primaryInputId, document: _primaryDocument)
+ .then((_) => documents);
}
AssetId _importId(AssetId source, Element import) {
« no previous file with comments | « lib/build/html_import_annotation_recorder.dart ('k') | lib/build/import_inliner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698