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

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

Issue 2243463003: Link with exports dependencies. (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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/pub_summary_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 bool failed = false; 521 bool failed = false;
522 522
523 _LinkedNode(this.package, this.unlinked, this.packageToNode); 523 _LinkedNode(this.package, this.unlinked, this.packageToNode);
524 524
525 @override 525 @override
526 bool get isEvaluated => linkedBuilder != null || failed; 526 bool get isEvaluated => linkedBuilder != null || failed;
527 527
528 @override 528 @override
529 List<_LinkedNode> computeDependencies() { 529 List<_LinkedNode> computeDependencies() {
530 Set<_LinkedNode> dependencies = new Set<_LinkedNode>(); 530 Set<_LinkedNode> dependencies = new Set<_LinkedNode>();
531
532 void appendDependency(String uriStr) {
533 Uri uri = FastUri.parse(uriStr);
534 if (!uri.hasScheme) {
535 // A relative path in this package, skip it.
536 } else if (uri.scheme == 'dart') {
537 // Dependency on the SDK is implicit and always added.
538 // The SDK linked bundle is precomputed before linking packages.
539 } else if (uriStr.startsWith('package:')) {
540 String package = PubSummaryManager.getPackageName(uriStr);
541 _LinkedNode packageNode = packageToNode[package];
542 if (packageNode == null) {
543 failed = true;
544 }
545 dependencies.add(packageNode);
546 } else {
547 failed = true;
548 }
549 }
550
531 for (UnlinkedUnit unit in unlinked.unlinkedUnits) { 551 for (UnlinkedUnit unit in unlinked.unlinkedUnits) {
532 for (UnlinkedImport import in unit.imports) { 552 for (UnlinkedImport import in unit.imports) {
533 String uriStr = import.isImplicit ? 'dart:core' : import.uri; 553 if (!import.isImplicit) {
534 Uri uri = FastUri.parse(uriStr); 554 appendDependency(import.uri);
535 if (!uri.hasScheme) {
536 // A relative path in this package, skip it.
537 } else if (uri.scheme == 'dart') {
538 // Dependency on the SDK is implicit and always added.
539 // The SDK linked bundle is precomputed before linking packages.
540 } else if (uriStr.startsWith('package:')) {
541 String package = PubSummaryManager.getPackageName(uriStr);
542 _LinkedNode packageNode = packageToNode[package];
543 if (packageNode == null) {
544 failed = true;
545 return const <_LinkedNode>[];
546 }
547 dependencies.add(packageNode);
548 } else {
549 failed = true;
550 return const <_LinkedNode>[];
551 } 555 }
552 } 556 }
557 for (UnlinkedExportPublic export in unit.publicNamespace.exports) {
558 appendDependency(export.uri);
559 }
560 }
561
562 if (failed) {
563 return const <_LinkedNode>[];
553 } 564 }
554 return dependencies.toList(); 565 return dependencies.toList();
555 } 566 }
556 567
557 @override 568 @override
558 String toString() => package.toString(); 569 String toString() => package.toString();
559 } 570 }
560 571
561 /** 572 /**
562 * Specialization of [DependencyWalker] for linking packages. 573 * Specialization of [DependencyWalker] for linking packages.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 618 }
608 }); 619 });
609 node.linkedBuilder = assembler.assemble(); 620 node.linkedBuilder = assembler.assemble();
610 store.addBundle(null, node.linkedBuilder); 621 store.addBundle(null, node.linkedBuilder);
611 } 622 }
612 } else { 623 } else {
613 scc.forEach((node) => node.failed = true); 624 scc.forEach((node) => node.failed = true);
614 } 625 }
615 } 626 }
616 } 627 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/pub_summary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698