| 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/types.dart' show DartType, FunctionType; | 9 import '../elements/types.dart' show DartType, FunctionType; |
| 10 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 receiver = js('this'); | 339 receiver = js('this'); |
| 340 } | 340 } |
| 341 } | 341 } |
| 342 statements | 342 statements |
| 343 .add(js.statement('return #.#(#)', [receiver, target, arguments])); | 343 .add(js.statement('return #.#(#)', [receiver, target, arguments])); |
| 344 | 344 |
| 345 return statements; | 345 return statements; |
| 346 } | 346 } |
| 347 | 347 |
| 348 bool isSupertypeOfNativeClass(ClassEntity element) { | 348 bool isSupertypeOfNativeClass(ClassEntity element) { |
| 349 if (backend.interceptorData.classesMixedIntoInterceptedClasses | 349 if (backend.interceptorData.isMixedIntoInterceptedClass(element)) { |
| 350 .contains(element)) { | |
| 351 return true; | 350 return true; |
| 352 } | 351 } |
| 353 | 352 |
| 354 return subtypes[element] != null; | 353 return subtypes[element] != null; |
| 355 } | 354 } |
| 356 | 355 |
| 357 bool requiresNativeIsCheck(ClassEntity element) { | 356 bool requiresNativeIsCheck(ClassEntity element) { |
| 358 // TODO(sra): Remove this function. It determines if a native type may | 357 // TODO(sra): Remove this function. It determines if a native type may |
| 359 // satisfy a check against [element], in which case an interceptor must be | 358 // satisfy a check against [element], in which case an interceptor must be |
| 360 // used. We should also use an interceptor if the check can't be satisfied | 359 // used. We should also use an interceptor if the check can't be satisfied |
| 361 // by a native class in case we get a native instance that tries to spoof | 360 // by a native class in case we get a native instance that tries to spoof |
| 362 // the type info. i.e the criteria for whether or not to use an interceptor | 361 // the type info. i.e the criteria for whether or not to use an interceptor |
| 363 // is whether the receiver can be native, not the type of the test. | 362 // is whether the receiver can be native, not the type of the test. |
| 364 ClassEntity cls = element; | 363 ClassEntity cls = element; |
| 365 if (backend.nativeData.isNativeOrExtendsNative(cls)) return true; | 364 if (backend.nativeData.isNativeOrExtendsNative(cls)) return true; |
| 366 return isSupertypeOfNativeClass(element); | 365 return isSupertypeOfNativeClass(element); |
| 367 } | 366 } |
| 368 } | 367 } |
| OLD | NEW |