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

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

Issue 2799063002: Revert "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 LibraryEntity rootLibrary = null; 876 // TODO(efortuna): Handle `prgram.mainMethod == null` gracefully.
877 if (program.mainMethod != null) {
878 rootLibrary = _worldBuilder
879 .lookupLibrary(program.mainMethod.enclosingLibrary.importUri);
880 }
881 return new _LoadedLibrariesAdapter( 877 return new _LoadedLibrariesAdapter(
882 rootLibrary, _allLoadedLibraries, _worldBuilder); 878 _worldBuilder
879 .lookupLibrary(program.mainMethod.enclosingLibrary.importUri),
880 _allLoadedLibraries,
881 _worldBuilder);
883 }); 882 });
884 }); 883 });
885 } 884 }
886 885
887 KernelWorldBuilder get worldBuilder => _worldBuilder; 886 KernelWorldBuilder get worldBuilder => _worldBuilder;
888 887
889 void reset({bool reuseLibrary(LibraryElement library)}) { 888 void reset({bool reuseLibrary(LibraryElement library)}) {
890 throw new UnimplementedError('_DillLibraryLoaderTask.reset'); 889 throw new UnimplementedError('_DillLibraryLoaderTask.reset');
891 } 890 }
892 891
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 } 1677 }
1679 1678
1680 /// API used by the library loader to synchronously scan a library or 1679 /// API used by the library loader to synchronously scan a library or
1681 /// compilation unit and ensure that their library tags are computed. 1680 /// compilation unit and ensure that their library tags are computed.
1682 abstract class ElementScanner { 1681 abstract class ElementScanner {
1683 void scanLibrary(LibraryElement library); 1682 void scanLibrary(LibraryElement library);
1684 void scanUnit(CompilationUnitElement unit); 1683 void scanUnit(CompilationUnitElement unit);
1685 } 1684 }
1686 1685
1687 const _reuseLibrarySubtaskName = "Reuse library"; 1686 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