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