| 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 library dart2js.js_emitter.native_emitter; |
| 6 |
| 7 import '../common.dart'; |
| 8 import '../compiler.dart' show Compiler; |
| 9 import '../elements/resolution_types.dart' |
| 10 show |
| 11 ResolutionDartType, |
| 12 ResolutionFunctionType; |
| 13 import '../elements/elements.dart' |
| 14 show |
| 15 ClassElement, |
| 16 Element, |
| 17 FunctionElement, |
| 18 FunctionSignature, |
| 19 ParameterElement; |
| 20 import '../js/js.dart' as jsAst; |
| 21 import '../js/js.dart' show js; |
| 22 import '../js_backend/backend_helpers.dart' show BackendHelpers; |
| 23 import '../js_backend/js_backend.dart' |
| 24 show |
| 25 JavaScriptBackend; |
| 26 import 'full_emitter/emitter.dart' as full_js_emitter; |
| 27 |
| 28 import 'code_emitter_task.dart' show CodeEmitterTask; |
| 29 import 'model.dart'; |
| 6 | 30 |
| 7 class NativeEmitter { | 31 class NativeEmitter { |
| 8 // TODO(floitsch): the native-emitter should not know about ClassBuilders. | 32 // TODO(floitsch): the native-emitter should not know about ClassBuilders. |
| 9 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; | 33 final Map<Element, full_js_emitter.ClassBuilder> cachedBuilders; |
| 10 | 34 |
| 11 final CodeEmitterTask emitterTask; | 35 final CodeEmitterTask emitterTask; |
| 12 | 36 |
| 13 // Whether the application contains native classes. | 37 // Whether the application contains native classes. |
| 14 bool hasNativeClasses = false; | 38 bool hasNativeClasses = false; |
| 15 | 39 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // used. We should also use an interceptor if the check can't be satisfied | 374 // used. We should also use an interceptor if the check can't be satisfied |
| 351 // by a native class in case we get a native instance that tries to spoof | 375 // by a native class in case we get a native instance that tries to spoof |
| 352 // the type info. i.e the criteria for whether or not to use an interceptor | 376 // the type info. i.e the criteria for whether or not to use an interceptor |
| 353 // is whether the receiver can be native, not the type of the test. | 377 // is whether the receiver can be native, not the type of the test. |
| 354 if (element == null || !element.isClass) return false; | 378 if (element == null || !element.isClass) return false; |
| 355 ClassElement cls = element; | 379 ClassElement cls = element; |
| 356 if (backend.isNativeOrExtendsNative(cls)) return true; | 380 if (backend.isNativeOrExtendsNative(cls)) return true; |
| 357 return isSupertypeOfNativeClass(element); | 381 return isSupertypeOfNativeClass(element); |
| 358 } | 382 } |
| 359 } | 383 } |
| OLD | NEW |