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

Unified Diff: compiler/java/com/google/dart/compiler/DartCompiler.java

Issue 8895029: Guard against NPE in: http://code.google.com/p/dart/issues/detail?id=815. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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: compiler/java/com/google/dart/compiler/DartCompiler.java
diff --git a/compiler/java/com/google/dart/compiler/DartCompiler.java b/compiler/java/com/google/dart/compiler/DartCompiler.java
index f589f283bab77e4bedb926957f3fbc407e32d299..558cbc30eb2001fe93c09d94d0e0a29c170a6e2e 100644
--- a/compiler/java/com/google/dart/compiler/DartCompiler.java
+++ b/compiler/java/com/google/dart/compiler/DartCompiler.java
@@ -187,7 +187,7 @@ public class DartCompiler {
* Update the current application and any referenced libraries and resolve
* them.
*
- * @return a {@link LibraryUnit}, never null
+ * @return a {@link LibraryUnit}, maybe <code>null</code>
* @throws IOException on IO errors - the caller must log this if it cares
*/
private LibraryUnit updateAndResolve() throws IOException {
@@ -1195,22 +1195,24 @@ public class DartCompiler {
DartCompilerMainContext context = new DartCompilerMainContext(lib, provider, listener, config);
Compiler compiler = new SelectiveCompiler(lib, parsedUnits, config, context);
LibraryUnit libraryUnit = compiler.updateAndResolve();
- // Ignore errors. Resolver should be able to cope with
- // errors. Otherwise, we should fix it.
- DartCompilationPhase[] phases = {
- new Resolver.Phase(),
- new TypeAnalyzer()
- };
- for (DartUnit unit : libraryUnit.getUnits()) {
- // Don't analyze api-only units.
- if (unit.isDiet()) {
- continue;
- }
-
- for (DartCompilationPhase phase : phases) {
- unit = phase.exec(unit, context, compiler.getTypeProvider());
- // Ignore errors. TypeAnalyzer should be able to cope with
- // resolution errors.
+ if (libraryUnit != null) {
+ // Ignore errors. Resolver should be able to cope with
+ // errors. Otherwise, we should fix it.
+ DartCompilationPhase[] phases = {
+ new Resolver.Phase(),
+ new TypeAnalyzer()
+ };
+ for (DartUnit unit : libraryUnit.getUnits()) {
+ // Don't analyze api-only units.
+ if (unit.isDiet()) {
+ continue;
+ }
+
+ for (DartCompilationPhase phase : phases) {
+ unit = phase.exec(unit, context, compiler.getTypeProvider());
+ // Ignore errors. TypeAnalyzer should be able to cope with
+ // resolution errors.
+ }
}
}
return libraryUnit;
« 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