| 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 library dart2js.js_emitter.native_emitter; | 5 library dart2js.js_emitter.native_emitter; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../elements/resolution_types.dart' | 9 import '../elements/resolution_types.dart' |
| 10 show ResolutionDartType, ResolutionFunctionType; | 10 show ResolutionDartType, ResolutionFunctionType; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | 170 |
| 171 // Collect all the tags that map to each native class. | 171 // Collect all the tags that map to each native class. |
| 172 | 172 |
| 173 Map<Class, Set<String>> leafTags = new Map<Class, Set<String>>(); | 173 Map<Class, Set<String>> leafTags = new Map<Class, Set<String>>(); |
| 174 Map<Class, Set<String>> nonleafTags = new Map<Class, Set<String>>(); | 174 Map<Class, Set<String>> nonleafTags = new Map<Class, Set<String>>(); |
| 175 | 175 |
| 176 for (Class cls in classes) { | 176 for (Class cls in classes) { |
| 177 if (!cls.isNative) continue; | 177 if (!cls.isNative) continue; |
| 178 if (backend.isJsInterop(cls.element)) continue; | 178 ClassElement element = cls.element; |
| 179 if (backend.isJsInterop(element)) continue; |
| 179 List<String> nativeTags = | 180 List<String> nativeTags = |
| 180 backend.nativeData.getNativeTagsOfClass(cls.element); | 181 backend.nativeData.getNativeTagsOfClass(cls.element); |
| 181 | 182 |
| 182 if (nonLeafClasses.contains(cls) || extensionPoints.containsKey(cls)) { | 183 if (nonLeafClasses.contains(cls) || extensionPoints.containsKey(cls)) { |
| 183 nonleafTags | 184 nonleafTags |
| 184 .putIfAbsent(cls, () => new Set<String>()) | 185 .putIfAbsent(cls, () => new Set<String>()) |
| 185 .addAll(nativeTags); | 186 .addAll(nativeTags); |
| 186 } else { | 187 } else { |
| 187 Class sufficingInterceptor = cls; | 188 Class sufficingInterceptor = cls; |
| 188 while (!neededClasses.contains(sufficingInterceptor)) { | 189 while (!neededClasses.contains(sufficingInterceptor)) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // used. We should also use an interceptor if the check can't be satisfied | 372 // used. We should also use an interceptor if the check can't be satisfied |
| 372 // by a native class in case we get a native instance that tries to spoof | 373 // by a native class in case we get a native instance that tries to spoof |
| 373 // the type info. i.e the criteria for whether or not to use an interceptor | 374 // the type info. i.e the criteria for whether or not to use an interceptor |
| 374 // is whether the receiver can be native, not the type of the test. | 375 // is whether the receiver can be native, not the type of the test. |
| 375 if (element == null || !element.isClass) return false; | 376 if (element == null || !element.isClass) return false; |
| 376 ClassElement cls = element; | 377 ClassElement cls = element; |
| 377 if (backend.isNativeOrExtendsNative(cls)) return true; | 378 if (backend.isNativeOrExtendsNative(cls)) return true; |
| 378 return isSupertypeOfNativeClass(element); | 379 return isSupertypeOfNativeClass(element); |
| 379 } | 380 } |
| 380 } | 381 } |
| OLD | NEW |