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

Side by Side Diff: pkg/analyzer/lib/src/summary/pub_summary.dart

Issue 2242963002: Add DartSdk.getLinkedBundle() and use it in PubSummaryManager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 import 'dart:core' hide Resource; 7 import 'dart:core' hide Resource;
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 } 218 }
219 219
220 /** 220 /**
221 * Return the list of linked [LinkedPubPackage]s that can be provided at this 221 * Return the list of linked [LinkedPubPackage]s that can be provided at this
222 * time for a subset of the packages used by the given [context]. If 222 * time for a subset of the packages used by the given [context]. If
223 * information about some of the used packages is not available yet, schedule 223 * information about some of the used packages is not available yet, schedule
224 * its computation, so that it might be available later for other contexts 224 * its computation, so that it might be available later for other contexts
225 * referencing the same packages. 225 * referencing the same packages.
226 */ 226 */
227 List<LinkedPubPackage> getLinkedBundles( 227 List<LinkedPubPackage> getLinkedBundles(AnalysisContext context) {
228 AnalysisContext context, PackageBundle sdkBundle) { 228 PackageBundle sdkBundle = context.sourceFactory.dartSdk.getLinkedBundle();
229 if (sdkBundle == null) {
230 return const <LinkedPubPackage>[];
231 }
232
229 Map<PubPackage, PackageBundle> unlinkedBundles = 233 Map<PubPackage, PackageBundle> unlinkedBundles =
230 getUnlinkedBundles(context); 234 getUnlinkedBundles(context);
231 235
232 // If no unlinked bundles, there is nothing we can try to link. 236 // If no unlinked bundles, there is nothing we can try to link.
233 if (unlinkedBundles.isEmpty) { 237 if (unlinkedBundles.isEmpty) {
234 return <LinkedPubPackage>[]; 238 return const <LinkedPubPackage>[];
235 } 239 }
236 240
237 // Create graph nodes for packages. 241 // Create graph nodes for packages.
238 List<_LinkedNode> nodes = <_LinkedNode>[]; 242 List<_LinkedNode> nodes = <_LinkedNode>[];
239 Map<String, _LinkedNode> packageToNode = <String, _LinkedNode>{}; 243 Map<String, _LinkedNode> packageToNode = <String, _LinkedNode>{};
240 unlinkedBundles.forEach((package, unlinked) { 244 unlinkedBundles.forEach((package, unlinked) {
241 _LinkedNode node = new _LinkedNode(package, unlinked, packageToNode); 245 _LinkedNode node = new _LinkedNode(package, unlinked, packageToNode);
242 nodes.add(node); 246 nodes.add(node);
243 packageToNode[package.name] = node; 247 packageToNode[package.name] = node;
244 }); 248 });
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 621 }
618 }); 622 });
619 node.linkedBuilder = assembler.assemble(); 623 node.linkedBuilder = assembler.assemble();
620 store.addBundle(null, node.linkedBuilder); 624 store.addBundle(null, node.linkedBuilder);
621 } 625 }
622 } else { 626 } else {
623 scc.forEach((node) => node.failed = true); 627 scc.forEach((node) => node.failed = true);
624 } 628 }
625 } 629 }
626 } 630 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/sdk_io.dart ('k') | pkg/analyzer/lib/src/summary/summary_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698