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

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

Issue 2858223004: Rename KernelElementAdapter and element_adapter.dart to IrToElementMap and ir_map.dart (Closed)
Patch Set: Updated cf. comments. Created 3 years, 7 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
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 12 matching lines...) Expand all
23 DeferredLoaderGetterElementX, 23 DeferredLoaderGetterElementX,
24 ErroneousElementX, 24 ErroneousElementX,
25 ExportElementX, 25 ExportElementX,
26 ImportElementX, 26 ImportElementX,
27 LibraryElementX, 27 LibraryElementX,
28 LibraryDependencyElementX, 28 LibraryDependencyElementX,
29 PrefixElementX, 29 PrefixElementX,
30 SyntheticImportElement; 30 SyntheticImportElement;
31 import 'enqueue.dart' show DeferredAction; 31 import 'enqueue.dart' show DeferredAction;
32 import 'environment.dart'; 32 import 'environment.dart';
33 import 'kernel/element_map.dart' show KernelToElementMap; 33 import 'kernel/element_map_impl.dart' show KernelToElementMapImpl;
34 import 'patch_parser.dart' show PatchParserTask; 34 import 'patch_parser.dart' show PatchParserTask;
35 import 'resolved_uri_translator.dart'; 35 import 'resolved_uri_translator.dart';
36 import 'script.dart'; 36 import 'script.dart';
37 import 'serialization/serialization.dart' show LibraryDeserializer; 37 import 'serialization/serialization.dart' show LibraryDeserializer;
38 import 'tree/tree.dart'; 38 import 'tree/tree.dart';
39 import 'util/util.dart' show Link, LinkBuilder; 39 import 'util/util.dart' show Link, LinkBuilder;
40 40
41 import 'package:kernel/ast.dart' as ir; 41 import 'package:kernel/ast.dart' as ir;
42 import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder; 42 import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
43 43
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 final DiagnosticReporter reporter; 813 final DiagnosticReporter reporter;
814 814
815 final ResolvedUriTranslator uriTranslator; 815 final ResolvedUriTranslator uriTranslator;
816 816
817 /// Loads the contents of a script file (a .dart file). Used when loading 817 /// Loads the contents of a script file (a .dart file). Used when loading
818 /// libraries from source. 818 /// libraries from source.
819 final ScriptLoader scriptLoader; 819 final ScriptLoader scriptLoader;
820 820
821 /// Holds the mapping of Kernel IR to KElements that is constructed as a 821 /// Holds the mapping of Kernel IR to KElements that is constructed as a
822 /// result of loading a program. 822 /// result of loading a program.
823 final KernelToElementMap _elementMap; 823 final KernelToElementMapImpl _elementMap;
824 824
825 List<LibraryEntity> _allLoadedLibraries; 825 List<LibraryEntity> _allLoadedLibraries;
826 826
827 DillLibraryLoaderTask(this._elementMap, this.uriTranslator, this.scriptLoader, 827 DillLibraryLoaderTask(this._elementMap, this.uriTranslator, this.scriptLoader,
828 this.reporter, Measurer measurer) 828 this.reporter, Measurer measurer)
829 : _allLoadedLibraries = new List<LibraryEntity>(), 829 : _allLoadedLibraries = new List<LibraryEntity>(),
830 super(measurer); 830 super(measurer);
831 831
832 /// Loads an entire Kernel [Program] from a file on disk (note, not just a 832 /// Loads an entire Kernel [Program] from a file on disk (note, not just a
833 /// library, so this name is actually a bit of a misnomer). 833 /// library, so this name is actually a bit of a misnomer).
(...skipping 23 matching lines...) Expand all
857 _allLoadedLibraries.add(_elementMap.lookupLibrary(library.importUri))); 857 _allLoadedLibraries.add(_elementMap.lookupLibrary(library.importUri)));
858 LibraryEntity rootLibrary = null; 858 LibraryEntity rootLibrary = null;
859 if (program.mainMethod != null) { 859 if (program.mainMethod != null) {
860 rootLibrary = _elementMap 860 rootLibrary = _elementMap
861 .lookupLibrary(program.mainMethod.enclosingLibrary.importUri); 861 .lookupLibrary(program.mainMethod.enclosingLibrary.importUri);
862 } 862 }
863 return new _LoadedLibrariesAdapter( 863 return new _LoadedLibrariesAdapter(
864 rootLibrary, _allLoadedLibraries, _elementMap); 864 rootLibrary, _allLoadedLibraries, _elementMap);
865 } 865 }
866 866
867 KernelToElementMap get elementMap => _elementMap; 867 KernelToElementMapImpl get elementMap => _elementMap;
868 868
869 void reset({bool reuseLibrary(LibraryElement library)}) { 869 void reset({bool reuseLibrary(LibraryElement library)}) {
870 throw new UnimplementedError('DillLibraryLoaderTask.reset'); 870 throw new UnimplementedError('DillLibraryLoaderTask.reset');
871 } 871 }
872 872
873 Future resetAsync(Future<bool> reuseLibrary(LibraryElement library)) { 873 Future resetAsync(Future<bool> reuseLibrary(LibraryElement library)) {
874 throw new UnimplementedError('DillLibraryLoaderTask.resetAsync'); 874 throw new UnimplementedError('DillLibraryLoaderTask.resetAsync');
875 } 875 }
876 876
877 Iterable<LibraryEntity> get libraries => _allLoadedLibraries; 877 Iterable<LibraryEntity> get libraries => _allLoadedLibraries;
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 } 1585 }
1586 1586
1587 String toString() => 'root=$rootLibrary,libraries=${_newLibraries}'; 1587 String toString() => 'root=$rootLibrary,libraries=${_newLibraries}';
1588 } 1588 }
1589 1589
1590 /// Adapter class to mimic the behavior of LoadedLibraries for Kernel element 1590 /// Adapter class to mimic the behavior of LoadedLibraries for Kernel element
1591 /// behavior. Ultimately we'll just access worldBuilder instead. 1591 /// behavior. Ultimately we'll just access worldBuilder instead.
1592 class _LoadedLibrariesAdapter implements LoadedLibraries { 1592 class _LoadedLibrariesAdapter implements LoadedLibraries {
1593 final LibraryEntity rootLibrary; 1593 final LibraryEntity rootLibrary;
1594 final List<LibraryEntity> _newLibraries; 1594 final List<LibraryEntity> _newLibraries;
1595 final KernelToElementMap worldBuilder; 1595 final KernelToElementMapImpl worldBuilder;
1596 1596
1597 _LoadedLibrariesAdapter( 1597 _LoadedLibrariesAdapter(
1598 this.rootLibrary, this._newLibraries, this.worldBuilder) { 1598 this.rootLibrary, this._newLibraries, this.worldBuilder) {
1599 assert(rootLibrary != null); 1599 assert(rootLibrary != null);
1600 } 1600 }
1601 1601
1602 bool containsLibrary(Uri uri) => getLibrary(uri) != null; 1602 bool containsLibrary(Uri uri) => getLibrary(uri) != null;
1603 1603
1604 LibraryEntity getLibrary(Uri uri) => worldBuilder.lookupLibrary(uri); 1604 LibraryEntity getLibrary(Uri uri) => worldBuilder.lookupLibrary(uri);
1605 1605
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 } 1659 }
1660 1660
1661 /// API used by the library loader to synchronously scan a library or 1661 /// API used by the library loader to synchronously scan a library or
1662 /// compilation unit and ensure that their library tags are computed. 1662 /// compilation unit and ensure that their library tags are computed.
1663 abstract class ElementScanner { 1663 abstract class ElementScanner {
1664 void scanLibrary(LibraryElement library); 1664 void scanLibrary(LibraryElement library);
1665 void scanUnit(CompilationUnitElement unit); 1665 void scanUnit(CompilationUnitElement unit);
1666 } 1666 }
1667 1667
1668 const _reuseLibrarySubtaskName = "Reuse library"; 1668 const _reuseLibrarySubtaskName = "Reuse library";
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/types.dart ('k') | pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698