Chromium Code Reviews| Index: lib/build/import_crawler.dart |
| diff --git a/lib/build/import_crawler.dart b/lib/build/import_crawler.dart |
| index c655efc7aece41ee5fa0c9a46c2f402d50caa8b6..d32b8268036da8cfe303424c87d2a3aef33cd377 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,18 @@ 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}) { |
|
Siggi Cherem (dart-lang)
2015/03/11 21:47:54
formatter?
|
| 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); |
| }); |
| } |
| @@ -74,7 +77,7 @@ class ImportCrawler { |
| } |
| return |
| - doCrawl(_primaryInputId, null, _primaryDocument).then((_) => documents); |
| + doCrawl(_primaryInputId, document: _primaryDocument).then((_) => documents); |
| } |
| AssetId _importId(AssetId source, Element import) { |