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

Unified Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1736013002: Fix library cycle computation in the presence of library handles. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/element/element.dart
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 6f4190e072656c5735091b3da79a9fcb22db00c7..e84dff2095823f606619abe35630e394c838f78f 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -16,6 +16,7 @@ import 'package:analyzer/src/dart/ast/utilities.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/generated/constant.dart'
show DartObject, EvaluationResultImpl;
+import 'package:analyzer/src/generated/element_handle.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisContext, AnalysisEngine;
import 'package:analyzer/src/generated/java_core.dart';
@@ -3265,6 +3266,17 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
indices[library] = index;
active.add(library);
stack.add(library);
+ LibraryElementImpl getActualLibrary(LibraryElement lib) {
+ // TODO(paulberry): this means that computing a library cycle will be
+ // expensive for libraries resynthesized from summaries, since it will
+ // require fully resynthesizing all the libraries in the cycle as well
+ // as any libraries they import or export. Try to find a better way.
Brian Wilkerson 2016/02/25 20:47:39 Eventually, resynthesis should be lazy, in which c
Paul Berry 2016/02/25 21:08:30 Yes, I hope to do that, but even under the optimis
+ if (lib is LibraryElementHandle) {
+ return lib.actualElement;
+ } else {
+ return lib;
+ }
+ }
void recurse(LibraryElementImpl child) {
if (!indices.containsKey(child)) {
// We haven't visited this child yet, so recurse on the child,
@@ -3282,9 +3294,11 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
// Recurse on all of the children in the import/export graph, filtering
// out those for which library cycles have already been computed.
library.exportedLibraries
+ .map(getActualLibrary)
.where((l) => l._libraryCycle == null)
.forEach(recurse);
library.importedLibraries
+ .map(getActualLibrary)
.where((l) => l._libraryCycle == null)
.forEach(recurse);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698