| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 import '../common.dart'; | 5 import '../common.dart'; |
| 6 import '../common_elements.dart'; | 6 import '../common_elements.dart'; |
| 7 import '../elements/elements.dart' show ErroneousElement; | 7 import '../elements/elements.dart' show ErroneousElement; |
| 8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 import '../elements/resolution_types.dart' show MalformedType; | 9 import '../elements/resolution_types.dart' show MalformedType; |
| 10 import '../elements/types.dart'; | 10 import '../elements/types.dart'; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (type.isTypeVariable) { | 205 if (type.isTypeVariable) { |
| 206 return typeCast | 206 return typeCast |
| 207 ? 'subtypeOfRuntimeTypeCast' | 207 ? 'subtypeOfRuntimeTypeCast' |
| 208 : 'assertSubtypeOfRuntimeType'; | 208 : 'assertSubtypeOfRuntimeType'; |
| 209 } | 209 } |
| 210 | 210 |
| 211 if (type.isFunctionType) { | 211 if (type.isFunctionType) { |
| 212 return typeCast ? 'functionTypeCast' : 'functionTypeCheck'; | 212 return typeCast ? 'functionTypeCast' : 'functionTypeCheck'; |
| 213 } | 213 } |
| 214 | 214 |
| 215 assert(invariant(NO_LOCATION_SPANNABLE, type.isInterfaceType, | 215 assert(type.isInterfaceType, |
| 216 message: "Unexpected type: $type")); | 216 failedAt(NO_LOCATION_SPANNABLE, "Unexpected type: $type")); |
| 217 InterfaceType interfaceType = type; | 217 InterfaceType interfaceType = type; |
| 218 ClassEntity element = interfaceType.element; | 218 ClassEntity element = interfaceType.element; |
| 219 bool nativeCheck = true; | 219 bool nativeCheck = true; |
| 220 // TODO(13955), TODO(9731). The test for non-primitive types should use an | 220 // TODO(13955), TODO(9731). The test for non-primitive types should use an |
| 221 // interceptor. The interceptor should be an argument to HTypeConversion so | 221 // interceptor. The interceptor should be an argument to HTypeConversion so |
| 222 // that it can be optimized by standard interceptor optimizations. | 222 // that it can be optimized by standard interceptor optimizations. |
| 223 // nativeCheckOnly || emitter.nativeEmitter.requiresNativeIsCheck(element); | 223 // nativeCheckOnly || emitter.nativeEmitter.requiresNativeIsCheck(element); |
| 224 | 224 |
| 225 var suffix = typeCast ? 'TypeCast' : 'TypeCheck'; | 225 var suffix = typeCast ? 'TypeCast' : 'TypeCheck'; |
| 226 if (element == _commonElements.jsStringClass || | 226 if (element == _commonElements.jsStringClass || |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 283 |
| 284 if (nativeCheck) { | 284 if (nativeCheck) { |
| 285 // TODO(karlklose): can we get rid of this branch when we use | 285 // TODO(karlklose): can we get rid of this branch when we use |
| 286 // interceptors? | 286 // interceptors? |
| 287 return 'intercepted$suffix'; | 287 return 'intercepted$suffix'; |
| 288 } else { | 288 } else { |
| 289 return 'property$suffix'; | 289 return 'property$suffix'; |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 } | 292 } |
| OLD | NEW |