| 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 abstract class HVisitor<R> { | 5 abstract class HVisitor<R> { |
| 6 R visitAdd(HAdd node); | 6 R visitAdd(HAdd node); |
| 7 R visitBailoutTarget(HBailoutTarget node); | 7 R visitBailoutTarget(HBailoutTarget node); |
| 8 R visitBitAnd(HBitAnd node); | 8 R visitBitAnd(HBitAnd node); |
| 9 R visitBitNot(HBitNot node); | 9 R visitBitNot(HBitNot node); |
| 10 R visitBitOr(HBitOr node); | 10 R visitBitOr(HBitOr node); |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1616 // are numbers. If we don't know the outgoing type we try to make it a | 1616 // are numbers. If we don't know the outgoing type we try to make it a |
| 1617 // number. | 1617 // number. |
| 1618 if (propagatedType.isUnknown() || propagatedType.isNumber()) { | 1618 if (propagatedType.isUnknown() || propagatedType.isNumber()) { |
| 1619 return HType.NUMBER; | 1619 return HType.NUMBER; |
| 1620 } | 1620 } |
| 1621 // Even if the desired outgoing type is not a number we still want the | 1621 // Even if the desired outgoing type is not a number we still want the |
| 1622 // second argument to be a number if the first one is a number. This will | 1622 // second argument to be a number if the first one is a number. This will |
| 1623 // not help for the outgoing type, but at least the binary arithmetic | 1623 // not help for the outgoing type, but at least the binary arithmetic |
| 1624 // operation will not have type problems. | 1624 // operation will not have type problems. |
| 1625 // TODO(floitsch): normally we shouldn't request a number, but simply | 1625 // TODO(floitsch): normally we shouldn't request a number, but simply |
| 1626 // throw an IllegalArgumentException if it isn't. This would be similar | 1626 // throw an ArgumentError if it isn't. This would be similar |
| 1627 // to the array case. | 1627 // to the array case. |
| 1628 if (input == right && left.isNumber(types)) return HType.NUMBER; | 1628 if (input == right && left.isNumber(types)) return HType.NUMBER; |
| 1629 return HType.UNKNOWN; | 1629 return HType.UNKNOWN; |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 HType computeLikelyType(HTypeMap types) { | 1632 HType computeLikelyType(HTypeMap types) { |
| 1633 if (left.isTypeUnknown(types)) return HType.NUMBER; | 1633 if (left.isTypeUnknown(types)) return HType.NUMBER; |
| 1634 return HType.UNKNOWN; | 1634 return HType.UNKNOWN; |
| 1635 } | 1635 } |
| 1636 | 1636 |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2904 HBasicBlock get start => expression.start; | 2904 HBasicBlock get start => expression.start; |
| 2905 HBasicBlock get end { | 2905 HBasicBlock get end { |
| 2906 // We don't create a switch block if there are no cases. | 2906 // We don't create a switch block if there are no cases. |
| 2907 assert(!statements.isEmpty()); | 2907 assert(!statements.isEmpty()); |
| 2908 return statements.last().end; | 2908 return statements.last().end; |
| 2909 } | 2909 } |
| 2910 | 2910 |
| 2911 bool accept(HStatementInformationVisitor visitor) => | 2911 bool accept(HStatementInformationVisitor visitor) => |
| 2912 visitor.visitSwitchInfo(this); | 2912 visitor.visitSwitchInfo(this); |
| 2913 } | 2913 } |
| OLD | NEW |