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

Unified Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/context/AnalysisContextImpl.java

Issue 411603002: Version 1.5.8 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.5/
Patch Set: Created 6 years, 5 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
Index: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/context/AnalysisContextImpl.java
===================================================================
--- dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/context/AnalysisContextImpl.java (revision 38461)
+++ dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/context/AnalysisContextImpl.java (working copy)
@@ -618,8 +618,26 @@
}
/**
+ * Ensure that the given library has an element model built for it. If another task needs to be
+ * executed first in order to build the element model, that task is placed in {@link #taskData}.
+ *
+ * @param library the library which needs an element model.
+ */
+ private void ensureElementModel(ResolvableLibrary library) {
+ Source librarySource = library.getLibrarySource();
+ DartEntry libraryEntry = getReadableDartEntry(librarySource);
+ if (libraryEntry != null && libraryEntry.getState(DartEntry.PARSED_UNIT) != CacheState.ERROR) {
+ workManager.addFirst(librarySource, SourcePriority.LIBRARY);
+ if (taskData == null) {
+ taskData = createResolveDartLibraryTask(librarySource, libraryEntry);
+ }
+ }
+ }
+
+ /**
* Ensure that all of the libraries that are exported by the given library (but are not
- * themselves in the cycle) have element models built for them.
+ * themselves in the cycle) have element models built for them. If another task needs to be
+ * executed first in order to build the element model, that task is placed in {@link #taskData}.
*
* @param library the library being tested
*/
@@ -631,31 +649,23 @@
if (!librariesInCycle.contains(dependency)
&& visitedLibraries.add(dependency.getLibrarySource())) {
if (dependency.getLibraryElement() == null) {
- Source dependencySource = dependency.getLibrarySource();
- workManager.addFirst(dependencySource, SourcePriority.LIBRARY);
- if (taskData == null) {
- taskData = createResolveDartLibraryTask(
- dependencySource,
- getReadableDartEntry(dependencySource));
- return;
- }
+ ensureElementModel(dependency);
} else {
ensureExports(dependency, visitedLibraries);
- if (taskData != null) {
- return;
- }
}
+ if (taskData != null) {
+ return;
+ }
}
}
}
/**
* Ensure that all of the libraries that are exported by the given library (but are not
- * themselves in the cycle) have element models built for them.
+ * themselves in the cycle) have element models built for them. If another task needs to be
+ * executed first in order to build the element model, that task is placed in {@link #taskData}.
*
* @param library the library being tested
- * @throws MissingDataException if there is at least one library being depended on that does not
- * have an element model built for it
*/
private void ensureImports(ResolvableLibrary library) {
ResolvableLibrary[] dependencies = library.getImports();
@@ -663,12 +673,8 @@
for (int i = 0; i < dependencyCount; i++) {
ResolvableLibrary dependency = dependencies[i];
if (!librariesInCycle.contains(dependency) && dependency.getLibraryElement() == null) {
- Source dependencySource = dependency.getLibrarySource();
- workManager.addFirst(dependencySource, SourcePriority.LIBRARY);
- if (taskData == null) {
- taskData = createResolveDartLibraryTask(
- dependencySource,
- getReadableDartEntry(dependencySource));
+ ensureElementModel(dependency);
+ if (taskData != null) {
return;
}
}
« no previous file with comments | « no previous file | dart/editor/tools/plugins/com.google.dart.engine_test/src/com/google/dart/engine/internal/context/AnalysisContextImplTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698