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

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

Issue 2944843002: All strong mode cleaning of dart2js. (Closed)
Patch Set: More issues discovered during testing. Created 3 years, 6 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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.kernel.element_map; 5 library dart2js.kernel.element_map;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 import 'package:kernel/clone.dart'; 8 import 'package:kernel/clone.dart';
9 import 'package:kernel/type_algebra.dart'; 9 import 'package:kernel/type_algebra.dart';
10 10
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 ResolutionImpact computeWorldImpact(KMember member) { 749 ResolutionImpact computeWorldImpact(KMember member) {
750 return _memberList[member.memberIndex].getWorldImpact(this); 750 return _memberList[member.memberIndex].getWorldImpact(this);
751 } 751 }
752 752
753 @override 753 @override
754 Spannable getSpannable(MemberEntity member, ir.Node node) { 754 Spannable getSpannable(MemberEntity member, ir.Node node) {
755 return member; 755 return member;
756 } 756 }
757 757
758 @override 758 @override
759 ir.Member getMemberNode(KMember member) { 759 ir.Member getMemberNode(covariant KMember member) {
760 return _memberList[member.memberIndex].node; 760 return _memberList[member.memberIndex].node;
761 } 761 }
762 762
763 /// Returns the kernel IR node that defines the [cls]. 763 /// Returns the kernel IR node that defines the [cls].
764 ir.Class getClassNode(KClass cls) { 764 ir.Class getClassNode(KClass cls) {
765 return _classEnvs[cls.classIndex].cls; 765 return _classEnvs[cls.classIndex].cls;
766 } 766 }
767 } 767 }
768 768
769 /// Environment for fast lookup of program libraries. 769 /// Environment for fast lookup of program libraries.
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 InterfaceType getRawType(ClassEntity cls) { 1183 InterfaceType getRawType(ClassEntity cls) {
1184 return elementMap._getRawType(cls); 1184 return elementMap._getRawType(cls);
1185 } 1185 }
1186 1186
1187 @override 1187 @override
1188 bool isGenericClass(ClassEntity cls) { 1188 bool isGenericClass(ClassEntity cls) {
1189 return getThisType(cls).typeArguments.isNotEmpty; 1189 return getThisType(cls).typeArguments.isNotEmpty;
1190 } 1190 }
1191 1191
1192 @override 1192 @override
1193 bool isMixinApplication(KClass cls) { 1193 bool isMixinApplication(covariant KClass cls) {
1194 return elementMap._isMixinApplication(cls); 1194 return elementMap._isMixinApplication(cls);
1195 } 1195 }
1196 1196
1197 @override 1197 @override
1198 bool isUnnamedMixinApplication(KClass cls) { 1198 bool isUnnamedMixinApplication(covariant KClass cls) {
1199 return elementMap._isUnnamedMixinApplication(cls); 1199 return elementMap._isUnnamedMixinApplication(cls);
1200 } 1200 }
1201 1201
1202 @override 1202 @override
1203 ClassEntity getEffectiveMixinClass(ClassEntity cls) { 1203 ClassEntity getEffectiveMixinClass(ClassEntity cls) {
1204 if (!isMixinApplication(cls)) return null; 1204 if (!isMixinApplication(cls)) return null;
1205 do { 1205 do {
1206 cls = elementMap._getAppliedMixin(cls); 1206 cls = elementMap._getAppliedMixin(cls);
1207 } while (isMixinApplication(cls)); 1207 } while (isMixinApplication(cls));
1208 return cls; 1208 return cls;
1209 } 1209 }
1210 1210
1211 @override 1211 @override
1212 DartType getTypeVariableBound(TypeVariableEntity typeVariable) { 1212 DartType getTypeVariableBound(TypeVariableEntity typeVariable) {
1213 throw new UnimplementedError( 1213 throw new UnimplementedError(
1214 'KernelElementEnvironment.getTypeVariableBound'); 1214 'KernelElementEnvironment.getTypeVariableBound');
1215 } 1215 }
1216 1216
1217 @override 1217 @override
1218 InterfaceType createInterfaceType( 1218 InterfaceType createInterfaceType(
1219 ClassEntity cls, List<DartType> typeArguments) { 1219 ClassEntity cls, List<DartType> typeArguments) {
1220 return new InterfaceType(cls, typeArguments); 1220 return new InterfaceType(cls, typeArguments);
1221 } 1221 }
1222 1222
1223 @override 1223 @override
1224 FunctionType getFunctionType(KFunction function) { 1224 FunctionType getFunctionType(covariant KFunction function) {
1225 return elementMap._getFunctionType(function); 1225 return elementMap._getFunctionType(function);
1226 } 1226 }
1227 1227
1228 @override 1228 @override
1229 FunctionType getLocalFunctionType(KLocalFunction function) { 1229 FunctionType getLocalFunctionType(covariant KLocalFunction function) {
1230 return function.functionType; 1230 return function.functionType;
1231 } 1231 }
1232 1232
1233 @override 1233 @override
1234 DartType getUnaliasedType(DartType type) => type; 1234 DartType getUnaliasedType(DartType type) => type;
1235 1235
1236 @override 1236 @override
1237 ConstructorEntity lookupConstructor(ClassEntity cls, String name, 1237 ConstructorEntity lookupConstructor(ClassEntity cls, String name,
1238 {bool required: false}) { 1238 {bool required: false}) {
1239 ConstructorEntity constructor = elementMap.lookupConstructor(cls, name); 1239 ConstructorEntity constructor = elementMap.lookupConstructor(cls, name);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 {bool required: false}) { 1316 {bool required: false}) {
1317 ClassEntity cls = elementMap.lookupClass(library, name); 1317 ClassEntity cls = elementMap.lookupClass(library, name);
1318 if (cls == null && required) { 1318 if (cls == null && required) {
1319 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE, 1319 throw new SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE,
1320 "The class '$name' was not found in library '${library.name}'."); 1320 "The class '$name' was not found in library '${library.name}'.");
1321 } 1321 }
1322 return cls; 1322 return cls;
1323 } 1323 }
1324 1324
1325 @override 1325 @override
1326 void forEachClass(KLibrary library, void f(ClassEntity cls)) { 1326 void forEachClass(covariant KLibrary library, void f(ClassEntity cls)) {
1327 elementMap._forEachClass(library, f); 1327 elementMap._forEachClass(library, f);
1328 } 1328 }
1329 1329
1330 @override 1330 @override
1331 LibraryEntity lookupLibrary(Uri uri, {bool required: false}) { 1331 LibraryEntity lookupLibrary(Uri uri, {bool required: false}) {
1332 LibraryEntity library = elementMap.lookupLibrary(uri); 1332 LibraryEntity library = elementMap.lookupLibrary(uri);
1333 if (library == null && required) { 1333 if (library == null && required) {
1334 throw new SpannableAssertionFailure( 1334 throw new SpannableAssertionFailure(
1335 CURRENT_ELEMENT_SPANNABLE, "The library '$uri' was not found."); 1335 CURRENT_ELEMENT_SPANNABLE, "The library '$uri' was not found.");
1336 } 1336 }
1337 return library; 1337 return library;
1338 } 1338 }
1339 1339
1340 @override 1340 @override
1341 bool isDeferredLoadLibraryGetter(KMember member) { 1341 bool isDeferredLoadLibraryGetter(covariant KMember member) {
1342 // TODO(johnniwinther): Support these. 1342 // TODO(johnniwinther): Support these.
1343 return false; 1343 return false;
1344 } 1344 }
1345 1345
1346 @override 1346 @override
1347 Iterable<ConstantValue> getMemberMetadata(KMember member) { 1347 Iterable<ConstantValue> getMemberMetadata(covariant KMember member) {
1348 _MemberData memberData = elementMap._memberList[member.memberIndex]; 1348 _MemberData memberData = elementMap._memberList[member.memberIndex];
1349 return memberData.getMetadata(elementMap); 1349 return memberData.getMetadata(elementMap);
1350 } 1350 }
1351 } 1351 }
1352 1352
1353 /// Visitor that converts kernel dart types into [DartType]. 1353 /// Visitor that converts kernel dart types into [DartType].
1354 class DartTypeConverter extends ir.DartTypeVisitor<DartType> { 1354 class DartTypeConverter extends ir.DartTypeVisitor<DartType> {
1355 final KernelToElementMapImpl elementAdapter; 1355 final KernelToElementMapImpl elementAdapter;
1356 bool topLevel = true; 1356 bool topLevel = true;
1357 1357
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 KernelNativeMemberResolver( 1701 KernelNativeMemberResolver(
1702 this.elementMap, this.nativeBasicData, this.nativeDataBuilder); 1702 this.elementMap, this.nativeBasicData, this.nativeDataBuilder);
1703 1703
1704 @override 1704 @override
1705 ElementEnvironment get elementEnvironment => elementMap.elementEnvironment; 1705 ElementEnvironment get elementEnvironment => elementMap.elementEnvironment;
1706 1706
1707 @override 1707 @override
1708 CommonElements get commonElements => elementMap.commonElements; 1708 CommonElements get commonElements => elementMap.commonElements;
1709 1709
1710 @override 1710 @override
1711 native.NativeBehavior computeNativeFieldStoreBehavior(KField field) { 1711 native.NativeBehavior computeNativeFieldStoreBehavior(
1712 covariant KField field) {
1712 ir.Field node = elementMap._memberList[field.memberIndex].node; 1713 ir.Field node = elementMap._memberList[field.memberIndex].node;
1713 return elementMap.getNativeBehaviorForFieldStore(node); 1714 return elementMap.getNativeBehaviorForFieldStore(node);
1714 } 1715 }
1715 1716
1716 @override 1717 @override
1717 native.NativeBehavior computeNativeFieldLoadBehavior(KField field, 1718 native.NativeBehavior computeNativeFieldLoadBehavior(covariant KField field,
1718 {bool isJsInterop}) { 1719 {bool isJsInterop}) {
1719 ir.Field node = elementMap._memberList[field.memberIndex].node; 1720 ir.Field node = elementMap._memberList[field.memberIndex].node;
1720 return elementMap.getNativeBehaviorForFieldLoad(node, 1721 return elementMap.getNativeBehaviorForFieldLoad(node,
1721 isJsInterop: isJsInterop); 1722 isJsInterop: isJsInterop);
1722 } 1723 }
1723 1724
1724 @override 1725 @override
1725 native.NativeBehavior computeNativeMethodBehavior(KFunction function, 1726 native.NativeBehavior computeNativeMethodBehavior(
1727 covariant KFunction function,
1726 {bool isJsInterop}) { 1728 {bool isJsInterop}) {
1727 ir.Member node = elementMap._memberList[function.memberIndex].node; 1729 ir.Member node = elementMap._memberList[function.memberIndex].node;
1728 return elementMap.getNativeBehaviorForMethod(node, 1730 return elementMap.getNativeBehaviorForMethod(node,
1729 isJsInterop: isJsInterop); 1731 isJsInterop: isJsInterop);
1730 } 1732 }
1731 1733
1732 @override 1734 @override
1733 bool isNativeMethod(KFunction function) { 1735 bool isNativeMethod(covariant KFunction function) {
1734 if (!native.maybeEnableNative(function.library.canonicalUri)) return false; 1736 if (!native.maybeEnableNative(function.library.canonicalUri)) return false;
1735 ir.Member node = elementMap._memberList[function.memberIndex].node; 1737 ir.Member node = elementMap._memberList[function.memberIndex].node;
1736 return node.isExternal && 1738 return node.isExternal &&
1737 !elementMap.isForeignLibrary(node.enclosingLibrary); 1739 !elementMap.isForeignLibrary(node.enclosingLibrary);
1738 } 1740 }
1739 1741
1740 @override 1742 @override
1741 bool isJsInteropMember(MemberEntity element) { 1743 bool isJsInteropMember(MemberEntity element) {
1742 // TODO(johnniwinther): Compute this. 1744 // TODO(johnniwinther): Compute this.
1743 return false; 1745 return false;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 @override 1865 @override
1864 DiagnosticReporter get reporter { 1866 DiagnosticReporter get reporter {
1865 return _elementMap.reporter; 1867 return _elementMap.reporter;
1866 } 1868 }
1867 1869
1868 @override 1870 @override
1869 ConstantValue getFieldConstantValue(ir.Field field) { 1871 ConstantValue getFieldConstantValue(ir.Field field) {
1870 throw new UnsupportedError("JsKernelToElementMap.getFieldConstantValue"); 1872 throw new UnsupportedError("JsKernelToElementMap.getFieldConstantValue");
1871 } 1873 }
1872 } 1874 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/kernel/element_map.dart ('k') | pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698