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

Side by Side Diff: pkg/compiler/lib/src/library_loader.dart

Issue 2816633003: Reapply "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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.library_loader; 5 library dart2js.library_loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'common/names.dart' show Uris; 9 import 'common/names.dart' show Uris;
10 import 'common/tasks.dart' show CompilerTask, Measurer; 10 import 'common/tasks.dart' show CompilerTask, Measurer;
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 ir.Program program = new ir.Program(); 866 ir.Program program = new ir.Program();
867 // Hack because the existing file has a terminating 0 and the 867 // Hack because the existing file has a terminating 0 and the
868 // BinaryBuilder doesn't expect that. 868 // BinaryBuilder doesn't expect that.
869 var bytes = new List<int>.from(script.file.slowUtf8ZeroTerminatedBytes()); 869 var bytes = new List<int>.from(script.file.slowUtf8ZeroTerminatedBytes());
870 bytes.removeLast(); 870 bytes.removeLast();
871 new BinaryBuilder(bytes).readProgram(program); 871 new BinaryBuilder(bytes).readProgram(program);
872 return measure(() { 872 return measure(() {
873 _worldBuilder = new KernelWorldBuilder(reporter, program); 873 _worldBuilder = new KernelWorldBuilder(reporter, program);
874 program.libraries.forEach((ir.Library library) => _allLoadedLibraries 874 program.libraries.forEach((ir.Library library) => _allLoadedLibraries
875 .add(_worldBuilder.lookupLibrary(library.importUri))); 875 .add(_worldBuilder.lookupLibrary(library.importUri)));
876 // TODO(efortuna): Handle `prgram.mainMethod == null` gracefully. 876 LibraryEntity rootLibrary = null;
877 if (program.mainMethod != null) {
878 rootLibrary = _worldBuilder
879 .lookupLibrary(program.mainMethod.enclosingLibrary.importUri);
880 }
877 return new _LoadedLibrariesAdapter( 881 return new _LoadedLibrariesAdapter(
878 _worldBuilder 882 rootLibrary, _allLoadedLibraries, _worldBuilder);
879 .lookupLibrary(program.mainMethod.enclosingLibrary.importUri),
880 _allLoadedLibraries,
881 _worldBuilder);
882 }); 883 });
883 }); 884 });
884 } 885 }
885 886
886 KernelWorldBuilder get worldBuilder => _worldBuilder; 887 KernelWorldBuilder get worldBuilder => _worldBuilder;
887 888
888 void reset({bool reuseLibrary(LibraryElement library)}) { 889 void reset({bool reuseLibrary(LibraryElement library)}) {
889 throw new UnimplementedError('_DillLibraryLoaderTask.reset'); 890 throw new UnimplementedError('_DillLibraryLoaderTask.reset');
890 } 891 }
891 892
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 } 1678 }
1678 1679
1679 /// API used by the library loader to synchronously scan a library or 1680 /// API used by the library loader to synchronously scan a library or
1680 /// compilation unit and ensure that their library tags are computed. 1681 /// compilation unit and ensure that their library tags are computed.
1681 abstract class ElementScanner { 1682 abstract class ElementScanner {
1682 void scanLibrary(LibraryElement library); 1683 void scanLibrary(LibraryElement library);
1683 void scanUnit(CompilationUnitElement unit); 1684 void scanUnit(CompilationUnitElement unit);
1684 } 1685 }
1685 1686
1686 const _reuseLibrarySubtaskName = "Reuse library"; 1687 const _reuseLibrarySubtaskName = "Reuse library";
OLDNEW
« 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