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

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

Issue 1334203002: Compute Compiler.proxyConstant on demand. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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.compiler_base; 5 library dart2js.compiler_base;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 EventSink, 8 EventSink,
9 Future; 9 Future;
10 10
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 reportWarning(NO_LOCATION_SPANNABLE, 841 reportWarning(NO_LOCATION_SPANNABLE,
842 MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, 842 MessageKind.IMPORT_EXPERIMENTAL_MIRRORS,
843 {'importChain': importChains.join( 843 {'importChain': importChains.join(
844 MessageTemplate.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)}); 844 MessageTemplate.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)});
845 } 845 }
846 } 846 }
847 847
848 functionClass.ensureResolved(this); 848 functionClass.ensureResolved(this);
849 functionApplyMethod = functionClass.lookupLocalMember('apply'); 849 functionApplyMethod = functionClass.lookupLocalMember('apply');
850 850
851 proxyConstant =
852 constants.getConstantValue(
853 resolver.constantCompiler.compileConstant(
854 coreLibrary.find('proxy')));
855
856 if (preserveComments) { 851 if (preserveComments) {
857 return libraryLoader.loadLibrary(Uris.dart_mirrors) 852 return libraryLoader.loadLibrary(Uris.dart_mirrors)
858 .then((LibraryElement libraryElement) { 853 .then((LibraryElement libraryElement) {
859 documentClass = libraryElement.find('Comment'); 854 documentClass = libraryElement.find('Comment');
860 }); 855 });
861 } 856 }
862 }).then((_) => backend.onLibrariesLoaded(loadedLibraries)); 857 }).then((_) => backend.onLibrariesLoaded(loadedLibraries));
863 } 858 }
864 859
860 bool isProxyConstant(ConstantValue value) {
861 FieldElement field = coreLibrary.find('proxy');
862 if (field == null) return false;
863 if (!enqueuer.resolution.hasBeenResolved(field)) return false;
864 if (proxyConstant == null) {
865 proxyConstant =
866 constants.getConstantValue(
867 resolver.constantCompiler.compileConstant(field));
868 }
869 return proxyConstant == value;
870 }
871
865 Element findRequiredElement(LibraryElement library, String name) { 872 Element findRequiredElement(LibraryElement library, String name) {
866 var element = library.find(name); 873 var element = library.find(name);
867 if (element == null) { 874 if (element == null) {
868 internalError(library, 875 internalError(library,
869 "The library '${library.canonicalUri}' does not contain required " 876 "The library '${library.canonicalUri}' does not contain required "
870 "element: '$name'."); 877 "element: '$name'.");
871 } 878 }
872 return element; 879 return element;
873 } 880 }
874 881
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 1792
1786 @override 1793 @override
1787 InterfaceType streamType([DartType elementType]) { 1794 InterfaceType streamType([DartType elementType]) {
1788 InterfaceType type = streamClass.computeType(compiler); 1795 InterfaceType type = streamClass.computeType(compiler);
1789 if (elementType == null) { 1796 if (elementType == null) {
1790 return streamClass.rawType; 1797 return streamClass.rawType;
1791 } 1798 }
1792 return type.createInstantiation([elementType]); 1799 return type.createInstantiation([elementType]);
1793 } 1800 }
1794 } 1801 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698