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_elements.dart' show CommonElements; | 7 import '../common_elements.dart' show CommonElements; |
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 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 | 1335 |
1336 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { | 1336 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { |
1337 if (type == null) return this; | 1337 if (type == null) return this; |
1338 type = type.unaliased; | 1338 type = type.unaliased; |
1339 // Only the builder knows how to create [HTypeConversion] | 1339 // Only the builder knows how to create [HTypeConversion] |
1340 // instructions with generics. It has the generic type context | 1340 // instructions with generics. It has the generic type context |
1341 // available. | 1341 // available. |
1342 assert(!type.isTypeVariable); | 1342 assert(!type.isTypeVariable); |
1343 assert(type.treatAsRaw || type.isFunctionType); | 1343 assert(type.treatAsRaw || type.isFunctionType); |
1344 if (type.isDynamic) return this; | 1344 if (type.isDynamic) return this; |
| 1345 if (type.isVoid) return this; |
1345 if (type == closedWorld.commonElements.objectType) return this; | 1346 if (type == closedWorld.commonElements.objectType) return this; |
1346 if (type.isVoid || type.isFunctionType || type.isMalformed) { | 1347 if (type.isFunctionType || type.isMalformed) { |
1347 return new HTypeConversion( | 1348 return new HTypeConversion( |
1348 type, kind, closedWorld.commonMasks.dynamicType, this); | 1349 type, kind, closedWorld.commonMasks.dynamicType, this); |
1349 } | 1350 } |
1350 assert(type.isInterfaceType); | 1351 assert(type.isInterfaceType); |
1351 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1352 if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
1352 // Boolean conversion checks work on non-nullable booleans. | 1353 // Boolean conversion checks work on non-nullable booleans. |
1353 return new HTypeConversion( | 1354 return new HTypeConversion( |
1354 type, kind, closedWorld.commonMasks.boolType, this); | 1355 type, kind, closedWorld.commonMasks.boolType, this); |
1355 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { | 1356 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { |
1356 throw 'creating compound check to $type (this = ${this})'; | 1357 throw 'creating compound check to $type (this = ${this})'; |
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3544 // ignore: MISSING_RETURN | 3545 // ignore: MISSING_RETURN |
3545 String get kindAsString { | 3546 String get kindAsString { |
3546 switch (kind) { | 3547 switch (kind) { |
3547 case TypeInfoExpressionKind.COMPLETE: | 3548 case TypeInfoExpressionKind.COMPLETE: |
3548 return 'COMPLETE'; | 3549 return 'COMPLETE'; |
3549 case TypeInfoExpressionKind.INSTANCE: | 3550 case TypeInfoExpressionKind.INSTANCE: |
3550 return 'INSTANCE'; | 3551 return 'INSTANCE'; |
3551 } | 3552 } |
3552 } | 3553 } |
3553 } | 3554 } |
OLD | NEW |