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 visitBitAnd(HBitAnd node); | 9 R visitBitAnd(HBitAnd node); |
10 R visitBitNot(HBitNot node); | 10 R visitBitNot(HBitNot node); |
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 } | 1197 } |
1198 | 1198 |
1199 HInstruction convertType(Compiler compiler, DartType type, int kind) { | 1199 HInstruction convertType(Compiler compiler, DartType type, int kind) { |
1200 if (type == null) return this; | 1200 if (type == null) return this; |
1201 type = type.unalias(compiler); | 1201 type = type.unalias(compiler); |
1202 // Only the builder knows how to create [HTypeConversion] | 1202 // Only the builder knows how to create [HTypeConversion] |
1203 // instructions with generics. It has the generic type context | 1203 // instructions with generics. It has the generic type context |
1204 // available. | 1204 // available. |
1205 assert(type.kind != TypeKind.TYPE_VARIABLE); | 1205 assert(type.kind != TypeKind.TYPE_VARIABLE); |
1206 assert(type.treatAsRaw || type.kind == TypeKind.FUNCTION); | 1206 assert(type.treatAsRaw || type.kind == TypeKind.FUNCTION); |
1207 if (type.treatAsDynamic) return this; | 1207 if (type.isDynamic) return this; |
1208 // The type element is either a class or the void element. | 1208 // The type element is either a class or the void element. |
1209 Element element = type.element; | 1209 Element element = type.element; |
1210 if (identical(element, compiler.objectClass)) return this; | 1210 if (identical(element, compiler.objectClass)) return this; |
1211 JavaScriptBackend backend = compiler.backend; | 1211 JavaScriptBackend backend = compiler.backend; |
1212 if (type.kind != TypeKind.INTERFACE) { | 1212 if (type.kind != TypeKind.INTERFACE) { |
1213 return new HTypeConversion(type, kind, backend.dynamicType, this); | 1213 return new HTypeConversion(type, kind, backend.dynamicType, this); |
1214 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { | 1214 } else if (kind == HTypeConversion.BOOLEAN_CONVERSION_CHECK) { |
1215 // Boolean conversion checks work on non-nullable booleans. | 1215 // Boolean conversion checks work on non-nullable booleans. |
1216 return new HTypeConversion(type, kind, backend.boolType, this); | 1216 return new HTypeConversion(type, kind, backend.boolType, this); |
1217 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { | 1217 } else if (kind == HTypeConversion.CHECKED_MODE_CHECK && !type.treatAsRaw) { |
(...skipping 1602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 HBasicBlock get start => expression.start; | 2820 HBasicBlock get start => expression.start; |
2821 HBasicBlock get end { | 2821 HBasicBlock get end { |
2822 // We don't create a switch block if there are no cases. | 2822 // We don't create a switch block if there are no cases. |
2823 assert(!statements.isEmpty); | 2823 assert(!statements.isEmpty); |
2824 return statements.last.end; | 2824 return statements.last.end; |
2825 } | 2825 } |
2826 | 2826 |
2827 bool accept(HStatementInformationVisitor visitor) => | 2827 bool accept(HStatementInformationVisitor visitor) => |
2828 visitor.visitSwitchInfo(this); | 2828 visitor.visitSwitchInfo(this); |
2829 } | 2829 } |
OLD | NEW |