| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 abstract class HVisitor<R> { | 7 abstract class HVisitor<R> { |
| 8 R visitAdd(HAdd node); | 8 R visitAdd(HAdd node); |
| 9 R visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
| 10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
| (...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 | 1120 |
| 1121 HInstruction convertType(Compiler compiler, DartType type, int kind) { | 1121 HInstruction convertType(Compiler compiler, DartType type, int kind) { |
| 1122 if (type == null) return this; | 1122 if (type == null) return this; |
| 1123 type = type.unalias(compiler); | 1123 type = type.unalias(compiler); |
| 1124 // Only the builder knows how to create [HTypeConversion] | 1124 // Only the builder knows how to create [HTypeConversion] |
| 1125 // instructions with generics. It has the generic type context | 1125 // instructions with generics. It has the generic type context |
| 1126 // available. | 1126 // available. |
| 1127 assert(type.kind != TypeKind.TYPE_VARIABLE); | 1127 assert(type.kind != TypeKind.TYPE_VARIABLE); |
| 1128 assert(type.isRaw || type.kind == TypeKind.FUNCTION); | 1128 assert(type.isRaw || type.kind == TypeKind.FUNCTION); |
| 1129 if (type.treatAsDynamic) return this; | 1129 if (type.treatAsDynamic) return this; |
| 1130 ClassElement element = type.element; | 1130 // The type element is either a class or the void element. |
| 1131 Element element = type.element; |
| 1131 if (identical(element, compiler.objectClass)) return this; | 1132 if (identical(element, compiler.objectClass)) return this; |
| 1132 if (type.kind != TypeKind.INTERFACE) { | 1133 if (type.kind != TypeKind.INTERFACE) { |
| 1133 return new HTypeConversion(type, kind, HType.UNKNOWN, this); | 1134 return new HTypeConversion(type, kind, HType.UNKNOWN, this); |
| 1134 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1135 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
| 1135 // Boolean conversion checks work on non-nullable booleans. | 1136 // Boolean conversion checks work on non-nullable booleans. |
| 1136 return new HTypeConversion(type, kind, HType.BOOLEAN, this); | 1137 return new HTypeConversion(type, kind, HType.BOOLEAN, this); |
| 1137 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) { | 1138 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.isRaw) { |
| 1138 throw 'creating compound check to $type (this = ${this})'; | 1139 throw 'creating compound check to $type (this = ${this})'; |
| 1139 } else { | 1140 } else { |
| 1140 HType subtype = new HType.subtype(element, compiler); | 1141 HType subtype = new HType.subtype(element, compiler); |
| 1141 return new HTypeConversion(type, kind, subtype, this); | 1142 return new HTypeConversion(type, kind, subtype, this); |
| 1142 } | 1143 } |
| 1143 } | 1144 } |
| 1144 | 1145 |
| 1145 /** | 1146 /** |
| 1146 * Return whether the instructions do not belong to a loop or | 1147 * Return whether the instructions do not belong to a loop or |
| 1147 * belong to the same loop. | 1148 * belong to the same loop. |
| 1148 */ | 1149 */ |
| (...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 HBasicBlock get start => expression.start; | 2779 HBasicBlock get start => expression.start; |
| 2779 HBasicBlock get end { | 2780 HBasicBlock get end { |
| 2780 // We don't create a switch block if there are no cases. | 2781 // We don't create a switch block if there are no cases. |
| 2781 assert(!statements.isEmpty); | 2782 assert(!statements.isEmpty); |
| 2782 return statements.last.end; | 2783 return statements.last.end; |
| 2783 } | 2784 } |
| 2784 | 2785 |
| 2785 bool accept(HStatementInformationVisitor visitor) => | 2786 bool accept(HStatementInformationVisitor visitor) => |
| 2786 visitor.visitSwitchInfo(this); | 2787 visitor.visitSwitchInfo(this); |
| 2787 } | 2788 } |
| OLD | NEW |