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

Unified Diff: pkg/compiler/lib/src/library_loader.dart

Issue 2800463002: Gracefully handle if loaded dill program has no mainMethod set. (Closed)
Patch Set: .. Created 3 years, 8 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/compiler/lib/src/library_loader.dart
diff --git a/pkg/compiler/lib/src/library_loader.dart b/pkg/compiler/lib/src/library_loader.dart
index 0903f6e84aaf494005a61d4150989ddd4230f410..9caf929497f187d9dfbe50b2a1b65ee05318526f 100644
--- a/pkg/compiler/lib/src/library_loader.dart
+++ b/pkg/compiler/lib/src/library_loader.dart
@@ -873,12 +873,13 @@ class _DillLibraryLoaderTask extends CompilerTask implements LibraryLoaderTask {
_worldBuilder = new KernelWorldBuilder(reporter, program);
program.libraries.forEach((ir.Library library) => _allLoadedLibraries
.add(_worldBuilder.lookupLibrary(library.importUri)));
- // TODO(efortuna): Handle `prgram.mainMethod == null` gracefully.
+ LibraryEntity rootLibrary = null;
+ if (program.mainMethod != null) {
+ rootLibrary = _worldBuilder
+ .lookupLibrary(program.mainMethod.enclosingLibrary.importUri);
+ }
return new _LoadedLibrariesAdapter(
- _worldBuilder
- .lookupLibrary(program.mainMethod.enclosingLibrary.importUri),
- _allLoadedLibraries,
- _worldBuilder);
+ rootLibrary, _allLoadedLibraries, _worldBuilder);
});
});
}
« 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