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 2677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 bool accept(HStatementInformationVisitor visitor) => | 2688 bool accept(HStatementInformationVisitor visitor) => |
2689 visitor.visitTryInfo(this); | 2689 visitor.visitTryInfo(this); |
2690 } | 2690 } |
2691 | 2691 |
2692 | 2692 |
2693 | 2693 |
2694 class HSwitchBlockInformation implements HStatementInformation { | 2694 class HSwitchBlockInformation implements HStatementInformation { |
2695 final HExpressionInformation expression; | 2695 final HExpressionInformation expression; |
2696 final List<List<Constant>> matchExpressions; | 2696 final List<List<Constant>> matchExpressions; |
2697 final List<HStatementInformation> statements; | 2697 final List<HStatementInformation> statements; |
2698 // If the switch has a default, it's the last statement block, which | |
2699 // may or may not have other expresions. | |
2700 final bool hasDefault; | |
2701 final TargetElement target; | 2698 final TargetElement target; |
2702 final List<LabelElement> labels; | 2699 final List<LabelElement> labels; |
2703 | 2700 |
2704 HSwitchBlockInformation(this.expression, | 2701 HSwitchBlockInformation(this.expression, |
2705 this.matchExpressions, | 2702 this.matchExpressions, |
2706 this.statements, | 2703 this.statements, |
2707 this.hasDefault, | |
2708 this.target, | 2704 this.target, |
2709 this.labels); | 2705 this.labels); |
2710 | 2706 |
2711 HBasicBlock get start => expression.start; | 2707 HBasicBlock get start => expression.start; |
2712 HBasicBlock get end { | 2708 HBasicBlock get end { |
2713 // We don't create a switch block if there are no cases. | 2709 // We don't create a switch block if there are no cases. |
2714 assert(!statements.isEmpty); | 2710 assert(!statements.isEmpty); |
2715 return statements.last.end; | 2711 return statements.last.end; |
2716 } | 2712 } |
2717 | 2713 |
2718 bool accept(HStatementInformationVisitor visitor) => | 2714 bool accept(HStatementInformationVisitor visitor) => |
2719 visitor.visitSwitchInfo(this); | 2715 visitor.visitSwitchInfo(this); |
2720 } | 2716 } |
OLD | NEW |