Add adt_def into Switch, since it's convenient to have in trans
This commit is contained in:
parent
b5d3580843
commit
3ab29d3378
@ -92,6 +92,7 @@ pub fn perform_test(&mut self,
|
||||
.collect();
|
||||
self.cfg.terminate(block, Terminator::Switch {
|
||||
discr: lvalue.clone(),
|
||||
adt_def: adt_def,
|
||||
targets: target_blocks.clone()
|
||||
});
|
||||
target_blocks
|
||||
|
@ -247,6 +247,7 @@ pub enum Terminator<'tcx> {
|
||||
/// lvalue evaluates to some enum; jump depending on the branch
|
||||
Switch {
|
||||
discr: Lvalue<'tcx>,
|
||||
adt_def: AdtDef<'tcx>,
|
||||
targets: Vec<BasicBlock>,
|
||||
},
|
||||
|
||||
@ -279,7 +280,7 @@ pub fn successors(&self) -> &[BasicBlock] {
|
||||
Goto { target: ref b } => slice::ref_slice(b),
|
||||
Panic { target: ref b } => slice::ref_slice(b),
|
||||
If { cond: _, targets: ref b } => b,
|
||||
Switch { discr: _, targets: ref b } => b,
|
||||
Switch { discr: _, adt_def: _, targets: ref b } => b,
|
||||
Diverge => &[],
|
||||
Return => &[],
|
||||
Call { data: _, targets: ref b } => b,
|
||||
@ -318,7 +319,7 @@ fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
|
||||
write!(fmt, "panic -> {:?}", target),
|
||||
If { cond: ref lv, ref targets } =>
|
||||
write!(fmt, "if({:?}) -> {:?}", lv, targets),
|
||||
Switch { discr: ref lv, ref targets } =>
|
||||
Switch { discr: ref lv, adt_def: _, ref targets } =>
|
||||
write!(fmt, "switch({:?}) -> {:?}", lv, targets),
|
||||
Diverge =>
|
||||
write!(fmt, "diverge"),
|
||||
|
Loading…
Reference in New Issue
Block a user