| OLD | NEW |
| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 typedef void Recompile(Element element); | 7 typedef void Recompile(Element element); |
| 8 | 8 |
| 9 class ReturnInfo { | 9 class ReturnInfo { |
| 10 HType returnType; | 10 HType returnType; |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 */ | 838 */ |
| 839 Set<ClassElement> getInterceptedClassesOn(SourceString name) { | 839 Set<ClassElement> getInterceptedClassesOn(SourceString name) { |
| 840 Set<Element> intercepted = interceptedElements[name]; | 840 Set<Element> intercepted = interceptedElements[name]; |
| 841 if (intercepted == null) return null; | 841 if (intercepted == null) return null; |
| 842 return interceptedClassesCache.putIfAbsent(name, () { | 842 return interceptedClassesCache.putIfAbsent(name, () { |
| 843 // Populate the cache by running through all the elements and | 843 // Populate the cache by running through all the elements and |
| 844 // determine if the given selector applies to them. | 844 // determine if the given selector applies to them. |
| 845 Set<ClassElement> result = new Set<ClassElement>(); | 845 Set<ClassElement> result = new Set<ClassElement>(); |
| 846 for (Element element in intercepted) { | 846 for (Element element in intercepted) { |
| 847 ClassElement classElement = element.getEnclosingClass(); | 847 ClassElement classElement = element.getEnclosingClass(); |
| 848 if (classElement.isNative() | 848 result.add(classElement); |
| 849 || interceptedClasses.contains(classElement)) { | |
| 850 result.add(classElement); | |
| 851 } | |
| 852 if (classesMixedIntoNativeClasses.contains(classElement)) { | |
| 853 Set<Element> nativeSubclasses = nativeSubclassesOfMixin(classElement); | |
| 854 if (nativeSubclasses != null) result.addAll(nativeSubclasses); | |
| 855 } | |
| 856 } | 849 } |
| 857 return result; | 850 return result; |
| 858 }); | 851 }); |
| 859 } | 852 } |
| 860 | 853 |
| 861 Set<Element> nativeSubclassesOfMixin(ClassElement mixin) { | |
| 862 Set<MixinApplicationElement> uses = compiler.world.mixinUses[mixin]; | |
| 863 if (uses == null) return null; | |
| 864 Set<Element> result = null; | |
| 865 for (MixinApplicationElement use in uses) { | |
| 866 Iterable<ClassElement> subclasses = compiler.world.subclasses[use]; | |
| 867 if (subclasses != null) { | |
| 868 for (ClassElement subclass in subclasses) { | |
| 869 if (subclass.isNative()) { | |
| 870 if (result == null) result = new Set<Element>(); | |
| 871 result.add(subclass); | |
| 872 } | |
| 873 } | |
| 874 } | |
| 875 } | |
| 876 return result; | |
| 877 } | |
| 878 | |
| 879 bool operatorEqHandlesNullArgument(FunctionElement operatorEqfunction) { | 854 bool operatorEqHandlesNullArgument(FunctionElement operatorEqfunction) { |
| 880 return specialOperatorEqClasses.contains( | 855 return specialOperatorEqClasses.contains( |
| 881 operatorEqfunction.getEnclosingClass()); | 856 operatorEqfunction.getEnclosingClass()); |
| 882 } | 857 } |
| 883 | 858 |
| 884 void initializeHelperClasses() { | 859 void initializeHelperClasses() { |
| 885 getInterceptorMethod = | 860 getInterceptorMethod = |
| 886 compiler.findInterceptor(const SourceString('getInterceptor')); | 861 compiler.findInterceptor(const SourceString('getInterceptor')); |
| 887 interceptedNames = | 862 interceptedNames = |
| 888 compiler.findInterceptor(const SourceString('interceptedNames')); | 863 compiler.findInterceptor(const SourceString('interceptedNames')); |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 ClassElement get constListImplementation => jsArrayClass; | 1786 ClassElement get constListImplementation => jsArrayClass; |
| 1812 ClassElement get fixedListImplementation => jsFixedArrayClass; | 1787 ClassElement get fixedListImplementation => jsFixedArrayClass; |
| 1813 ClassElement get growableListImplementation => jsExtendableArrayClass; | 1788 ClassElement get growableListImplementation => jsExtendableArrayClass; |
| 1814 ClassElement get mapImplementation => mapLiteralClass; | 1789 ClassElement get mapImplementation => mapLiteralClass; |
| 1815 ClassElement get constMapImplementation => constMapLiteralClass; | 1790 ClassElement get constMapImplementation => constMapLiteralClass; |
| 1816 ClassElement get functionImplementation => jsFunctionClass; | 1791 ClassElement get functionImplementation => jsFunctionClass; |
| 1817 ClassElement get typeImplementation => typeLiteralClass; | 1792 ClassElement get typeImplementation => typeLiteralClass; |
| 1818 ClassElement get boolImplementation => jsBoolClass; | 1793 ClassElement get boolImplementation => jsBoolClass; |
| 1819 ClassElement get nullImplementation => jsNullClass; | 1794 ClassElement get nullImplementation => jsNullClass; |
| 1820 } | 1795 } |
| OLD | NEW |