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

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

Issue 2595493002: Merge CoreTypes and CoreClasses into CommonElements. (Closed)
Patch Set: Updated cf. comment Created 4 years 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 | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/elements/common.dart » ('j') | 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 deferred_load; 5 library deferred_load;
6 6
7 import 'common/backend_api.dart' show Backend; 7 import 'common/backend_api.dart' show Backend;
8 import 'common/tasks.dart' show CompilerTask; 8 import 'common/tasks.dart' show CompilerTask;
9 import 'common.dart'; 9 import 'common.dart';
10 import 'compiler.dart' show Compiler; 10 import 'compiler.dart' show Compiler;
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 // TODO(sigurdm): Make helper getLibraryImportTags when tags is a List 790 // TODO(sigurdm): Make helper getLibraryImportTags when tags is a List
791 // instead of a Link. 791 // instead of a Link.
792 for (ImportElement import in library.imports) { 792 for (ImportElement import in library.imports) {
793 /// Give an error if the old annotation-based syntax has been used. 793 /// Give an error if the old annotation-based syntax has been used.
794 List<MetadataAnnotation> metadataList = import.metadata; 794 List<MetadataAnnotation> metadataList = import.metadata;
795 if (metadataList != null) { 795 if (metadataList != null) {
796 for (MetadataAnnotation metadata in metadataList) { 796 for (MetadataAnnotation metadata in metadataList) {
797 metadata.ensureResolved(compiler.resolution); 797 metadata.ensureResolved(compiler.resolution);
798 ConstantValue value = 798 ConstantValue value =
799 compiler.constants.getConstantValue(metadata.constant); 799 compiler.constants.getConstantValue(metadata.constant);
800 Element element = value.getType(compiler.coreTypes).element; 800 Element element = value.getType(compiler.commonElements).element;
801 if (element == deferredLibraryClass) { 801 if (element == deferredLibraryClass) {
802 reporter.reportErrorMessage( 802 reporter.reportErrorMessage(
803 import, MessageKind.DEFERRED_OLD_SYNTAX); 803 import, MessageKind.DEFERRED_OLD_SYNTAX);
804 } 804 }
805 } 805 }
806 } 806 }
807 807
808 String prefix = (import.prefix != null) ? import.prefix.name : null; 808 String prefix = (import.prefix != null) ? import.prefix.name : null;
809 // The last import we saw with the same prefix. 809 // The last import we saw with the same prefix.
810 ImportElement previousDeferredImport = prefixDeferredImport[prefix]; 810 ImportElement previousDeferredImport = prefixDeferredImport[prefix];
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 result = ''; 1026 result = '';
1027 } 1027 }
1028 } else { 1028 } else {
1029 // Finds the first argument to the [DeferredLibrary] annotation 1029 // Finds the first argument to the [DeferredLibrary] annotation
1030 List<MetadataAnnotation> metadatas = declaration.metadata; 1030 List<MetadataAnnotation> metadatas = declaration.metadata;
1031 assert(metadatas != null); 1031 assert(metadatas != null);
1032 for (MetadataAnnotation metadata in metadatas) { 1032 for (MetadataAnnotation metadata in metadatas) {
1033 metadata.ensureResolved(compiler.resolution); 1033 metadata.ensureResolved(compiler.resolution);
1034 ConstantValue value = 1034 ConstantValue value =
1035 compiler.constants.getConstantValue(metadata.constant); 1035 compiler.constants.getConstantValue(metadata.constant);
1036 Element element = value.getType(compiler.coreTypes).element; 1036 Element element = value.getType(compiler.commonElements).element;
1037 if (element == compiler.commonElements.deferredLibraryClass) { 1037 if (element == compiler.commonElements.deferredLibraryClass) {
1038 ConstructedConstantValue constant = value; 1038 ConstructedConstantValue constant = value;
1039 StringConstantValue s = constant.fields.values.single; 1039 StringConstantValue s = constant.fields.values.single;
1040 result = s.primitiveValue.slowToString(); 1040 result = s.primitiveValue.slowToString();
1041 break; 1041 break;
1042 } 1042 }
1043 } 1043 }
1044 } 1044 }
1045 assert(result != null); 1045 assert(result != null);
1046 return result; 1046 return result;
1047 } 1047 }
1048 1048
1049 bool operator ==(other) { 1049 bool operator ==(other) {
1050 if (other is! _DeclaredDeferredImport) return false; 1050 if (other is! _DeclaredDeferredImport) return false;
1051 return declaration == other.declaration; 1051 return declaration == other.declaration;
1052 } 1052 }
1053 1053
1054 int get hashCode => declaration.hashCode * 17; 1054 int get hashCode => declaration.hashCode * 17;
1055 1055
1056 String toString() => '$declaration'; 1056 String toString() => '$declaration';
1057 } 1057 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart_types.dart ('k') | pkg/compiler/lib/src/elements/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698