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

Unified Diff: compiler/java/com/google/dart/compiler/backend/doc/DartDocumentationGenerator.java

Issue 9148026: Recompile unit with potential conflict/dependency on some top-level symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix for compiling corelib, so NPE in TreeShaker Created 8 years, 11 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: compiler/java/com/google/dart/compiler/backend/doc/DartDocumentationGenerator.java
diff --git a/compiler/java/com/google/dart/compiler/backend/doc/DartDocumentationGenerator.java b/compiler/java/com/google/dart/compiler/backend/doc/DartDocumentationGenerator.java
index 9eac11724289f85e4adece1e7da34eabf983ff10..58a12d03b21e1dbb52b9b43bc3c77a98b44f98da 100644
--- a/compiler/java/com/google/dart/compiler/backend/doc/DartDocumentationGenerator.java
+++ b/compiler/java/com/google/dart/compiler/backend/doc/DartDocumentationGenerator.java
@@ -4,6 +4,7 @@
package com.google.dart.compiler.backend.doc;
+import com.google.common.collect.Lists;
import com.google.dart.compiler.DartCompilerContext;
import com.google.dart.compiler.DartSource;
import com.google.dart.compiler.LibrarySource;
@@ -80,7 +81,7 @@ public class DartDocumentationGenerator extends AbstractBackend {
List<ClassElement> exceptions = new ArrayList<ClassElement>(10);
List<FieldElement> fields = new ArrayList<FieldElement>(10);
List<MethodElement> methods = new ArrayList<MethodElement>(10);
- for (DartNode dartNode : lib.getTopLevelNodes()) {
+ for (DartNode dartNode : getTopLevelNodes(lib)) {
if (dartNode instanceof DartClass) {
DartClass dartClass = (DartClass) dartNode;
ClassElement classElement = dartClass.getSymbol();
@@ -181,6 +182,18 @@ public class DartDocumentationGenerator extends AbstractBackend {
}
}
+ /**
+ * @return all top-level declarations in the given {@link LibraryUnit}.
+ */
+ private static List<DartNode> getTopLevelNodes(LibraryUnit lib) {
+ List<DartNode> topLevelNodes = Lists.newArrayList();
+ Iterable<DartUnit> units = lib.getUnits();
+ for (DartUnit unit : units) {
+ topLevelNodes.addAll(unit.getTopLevelNodes());
+ }
+ return topLevelNodes;
+ }
+
@Override
public boolean isOutOfDate(DartSource src, DartCompilerContext context) {
return true;
@@ -214,7 +227,7 @@ public class DartDocumentationGenerator extends AbstractBackend {
stream.println("<section id=\"libraries-overview\">");
for (LibraryUnit lib : libraries) {
if (library == null || library.equals(lib.getName())) {
- if (lib.getTopLevelNodes().size() > 0) {
+ if (!getTopLevelNodes(lib).isEmpty()) {
stream.print("<h2>");
stream.print(lib.getName());
stream.println("</h2>");

Powered by Google App Engine
This is Rietveld 408576698