| 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 dart2js.js_emitter; | 5 part of dart2js.js_emitter; |
| 6 | 6 |
| 7 class NativeEmitter { | 7 class NativeEmitter { |
| 8 | 8 |
| 9 final Map<Element, ClassBuilder> cachedBuilders; | 9 // TODO(floitsch): the native-emitter should not know about ClassBuilders. |
| 10 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; |
| 10 | 11 |
| 11 final CodeEmitterTask emitterTask; | 12 final CodeEmitterTask emitterTask; |
| 12 | 13 |
| 13 // Whether the application contains native classes. | 14 // Whether the application contains native classes. |
| 14 bool hasNativeClasses = false; | 15 bool hasNativeClasses = false; |
| 15 | 16 |
| 16 // Caches the native subtypes of a native class. | 17 // Caches the native subtypes of a native class. |
| 17 Map<ClassElement, List<ClassElement>> subtypes; | 18 Map<ClassElement, List<ClassElement>> subtypes; |
| 18 | 19 |
| 19 // Caches the direct native subtypes of a native class. | 20 // Caches the direct native subtypes of a native class. |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // used. We should also use an interceptor if the check can't be satisfied | 343 // used. We should also use an interceptor if the check can't be satisfied |
| 343 // by a native class in case we get a native instance that tries to spoof | 344 // by a native class in case we get a native instance that tries to spoof |
| 344 // the type info. i.e the criteria for whether or not to use an interceptor | 345 // the type info. i.e the criteria for whether or not to use an interceptor |
| 345 // is whether the receiver can be native, not the type of the test. | 346 // is whether the receiver can be native, not the type of the test. |
| 346 if (element == null || !element.isClass) return false; | 347 if (element == null || !element.isClass) return false; |
| 347 ClassElement cls = element; | 348 ClassElement cls = element; |
| 348 if (Elements.isNativeOrExtendsNative(cls)) return true; | 349 if (Elements.isNativeOrExtendsNative(cls)) return true; |
| 349 return isSupertypeOfNativeClass(element); | 350 return isSupertypeOfNativeClass(element); |
| 350 } | 351 } |
| 351 } | 352 } |
| OLD | NEW |