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 import '../closure.dart'; | 5 import '../closure.dart'; |
6 import '../common.dart'; | 6 import '../common.dart'; |
7 import '../common/backend_api.dart' show BackendClasses; | 7 import '../common/backend_api.dart' show BackendClasses; |
8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 | 1333 |
1334 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { | 1334 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { |
1335 if (type == null) return this; | 1335 if (type == null) return this; |
1336 type = type.unaliased; | 1336 type = type.unaliased; |
1337 // Only the builder knows how to create [HTypeConversion] | 1337 // Only the builder knows how to create [HTypeConversion] |
1338 // instructions with generics. It has the generic type context | 1338 // instructions with generics. It has the generic type context |
1339 // available. | 1339 // available. |
1340 assert(!type.isTypeVariable); | 1340 assert(!type.isTypeVariable); |
1341 assert(type.treatAsRaw || type.isFunctionType); | 1341 assert(type.treatAsRaw || type.isFunctionType); |
1342 if (type.isDynamic) return this; | 1342 if (type.isDynamic) return this; |
| 1343 if (type.isVoid) return this; |
1343 if (type == closedWorld.commonElements.objectType) return this; | 1344 if (type == closedWorld.commonElements.objectType) return this; |
1344 if (type.isVoid || type.isFunctionType || type.isMalformed) { | 1345 if (type.isFunctionType || type.isMalformed) { |
1345 return new HTypeConversion( | 1346 return new HTypeConversion( |
1346 type, kind, closedWorld.commonMasks.dynamicType, this); | 1347 type, kind, closedWorld.commonMasks.dynamicType, this); |
1347 } | 1348 } |
1348 assert(type.isInterfaceType); | 1349 assert(type.isInterfaceType); |
1349 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1350 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
1350 // Boolean conversion checks work on non-nullable booleans. | 1351 // Boolean conversion checks work on non-nullable booleans. |
1351 return new HTypeConversion( | 1352 return new HTypeConversion( |
1352 type, kind, closedWorld.commonMasks.boolType, this); | 1353 type, kind, closedWorld.commonMasks.boolType, this); |
1353 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { | 1354 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { |
1354 throw 'creating compound check to $type (this = ${this})'; | 1355 throw 'creating compound check to $type (this = ${this})'; |
(...skipping 2025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3380 | 3381 |
3381 String get kindAsString { | 3382 String get kindAsString { |
3382 switch (kind) { | 3383 switch (kind) { |
3383 case TypeInfoExpressionKind.COMPLETE: | 3384 case TypeInfoExpressionKind.COMPLETE: |
3384 return 'COMPLETE'; | 3385 return 'COMPLETE'; |
3385 case TypeInfoExpressionKind.INSTANCE: | 3386 case TypeInfoExpressionKind.INSTANCE: |
3386 return 'INSTANCE'; | 3387 return 'INSTANCE'; |
3387 } | 3388 } |
3388 } | 3389 } |
3389 } | 3390 } |
OLD | NEW |