| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface HVisitor<R> { | 5 interface HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBitAnd(HBitAnd node); | 7 R visitBitAnd(HBitAnd node); |
| 8 R visitBitNot(HBitNot node); | 8 R visitBitNot(HBitNot node); |
| 9 R visitBitOr(HBitOr node); | 9 R visitBitOr(HBitOr node); |
| 10 R visitBitXor(HBitXor node); | 10 R visitBitXor(HBitXor node); |
| (...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1198 bool hasExpectedType() => builtin || type.isUnknown() || left.isString(); | 1198 bool hasExpectedType() => builtin || type.isUnknown() || left.isString(); |
| 1199 | 1199 |
| 1200 HType computeDesiredInputType(HInstruction input) { | 1200 HType computeDesiredInputType(HInstruction input) { |
| 1201 // TODO(floitsch): we want the target to be a function. | 1201 // TODO(floitsch): we want the target to be a function. |
| 1202 if (input == target) return HType.UNKNOWN; | 1202 if (input == target) return HType.UNKNOWN; |
| 1203 if (isString() || left.isString()) { | 1203 if (isString() || left.isString()) { |
| 1204 return (input == left) ? HType.STRING : HType.UNKNOWN; | 1204 return (input == left) ? HType.STRING : HType.UNKNOWN; |
| 1205 } | 1205 } |
| 1206 if (right.isString()) return HType.STRING; | 1206 if (right.isString()) return HType.STRING; |
| 1207 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; | 1207 if (isNumber() || left.isNumber() || right.isNumber()) return HType.NUMBER; |
| 1208 if (type.isUnknown()) return HType.NUMBER; | |
| 1209 return HType.UNKNOWN; | 1208 return HType.UNKNOWN; |
| 1210 } | 1209 } |
| 1211 } | 1210 } |
| 1212 | 1211 |
| 1213 class HDivide extends HBinaryArithmetic { | 1212 class HDivide extends HBinaryArithmetic { |
| 1214 HDivide(HStatic target, HInstruction left, HInstruction right) | 1213 HDivide(HStatic target, HInstruction left, HInstruction right) |
| 1215 : super(target, left, right); | 1214 : super(target, left, right); |
| 1216 accept(HVisitor visitor) => visitor.visitDivide(this); | 1215 accept(HVisitor visitor) => visitor.visitDivide(this); |
| 1217 num evaluate(num a, num b) => a / b; | 1216 num evaluate(num a, num b) => a / b; |
| 1218 bool typeEquals(other) => other is HDivide; | 1217 bool typeEquals(other) => other is HDivide; |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 HInstruction first, | 1993 HInstruction first, |
| 1995 HInstruction second) | 1994 HInstruction second) |
| 1996 : super(<HInstruction>[first, second]); | 1995 : super(<HInstruction>[first, second]); |
| 1997 toString() => operation; | 1996 toString() => operation; |
| 1998 accept(HVisitor visitor) => visitor.visitLogicalOperator(this); | 1997 accept(HVisitor visitor) => visitor.visitLogicalOperator(this); |
| 1999 HInstruction get left() => inputs[0]; | 1998 HInstruction get left() => inputs[0]; |
| 2000 HInstruction get right() => inputs[1]; | 1999 HInstruction get right() => inputs[1]; |
| 2001 HType computeType() => HType.BOOLEAN; | 2000 HType computeType() => HType.BOOLEAN; |
| 2002 bool hasExpectedType() => true; | 2001 bool hasExpectedType() => true; |
| 2003 } | 2002 } |
| OLD | NEW |