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

Unified Diff: lib/src/transformer/asset_universe.dart

Issue 1788973002: Remove code that requires whole-program compile (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged 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
« no previous file with comments | « lib/src/transformer/asset_source.dart ('k') | lib/src/transformer/error_listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/transformer/asset_universe.dart
diff --git a/lib/src/transformer/asset_universe.dart b/lib/src/transformer/asset_universe.dart
deleted file mode 100644
index 5283589234f8351ed4aac849fd88fd8ee5a06f97..0000000000000000000000000000000000000000
--- a/lib/src/transformer/asset_universe.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dev_compiler.src.transformer.asset_universe;
-
-import 'dart:async';
-
-import 'package:analyzer/analyzer.dart' show UriBasedDirective, parseDirectives;
-import 'package:barback/barback.dart' show Asset, AssetId;
-
-import 'asset_source.dart';
-import 'uri_resolver.dart' show assetIdToUri, resolveAssetId;
-
-/// Set of assets sources available for analysis / compilation.
-class AssetUniverse {
- final _assetCache = <AssetId, AssetSource>{};
-
- Iterable<AssetId> get assetIds => _assetCache.keys;
-
- AssetSource getAssetSource(AssetId id) {
- var source = _assetCache[id];
- if (source == null) {
- throw new ArgumentError(id.toString());
- }
- return source;
- }
-
- /// Recursively loads the asset with [id] and all its transitive dependencies.
- Future scanSources(AssetId id, Future<Asset> getInput(AssetId id)) async {
- if (_assetCache.containsKey(id)) return;
-
- var asset = await getInput(id);
- var contents = await asset.readAsString();
- _assetCache[id] =
- new AssetSource(Uri.parse(assetIdToUri(id)), asset, contents);
-
- var deps = _getDependentAssetIds(id, contents);
- await Future.wait(deps.map((depId) => scanSources(depId, getInput)));
- }
-
- Iterable<AssetId> _getDependentAssetIds(AssetId id, String contents) sync* {
- var directives = parseDirectives(contents, suppressErrors: true).directives;
- for (var directive in directives) {
- if (directive is UriBasedDirective) {
- var uri = directive.uri.stringValue;
- var assetId = resolveAssetId(Uri.parse(uri), fromAssetId: id);
- if (assetId != null) yield assetId;
- }
- }
- }
-}
« no previous file with comments | « lib/src/transformer/asset_source.dart ('k') | lib/src/transformer/error_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698