@ -50,7 +50,7 @@ impl Flatten for InstrWithBranches {
}
}
if cnt ! = branch_count - 1 & & cond = = Cond ::True {
if cnt ! = branch_count - 1 & & cond = = Cond ::True {
warn ! ( "\"Else\" conditional used in non-final branch at {}:{} " , branch . pos ( ) . line , branch . pos ( ) . column ) ;
warn ! ( "\"Else\" conditional used in non-final branch at {}" , branch . pos ( ) ) ;
}
}
let next_lbl = if cnt = = branch_count - 1 {
let next_lbl = if cnt = = branch_count - 1 {
@ -68,11 +68,13 @@ impl Flatten for InstrWithBranches {
// optimization for single-branch conditionals with a single instruction
// optimization for single-branch conditionals with a single instruction
ops . push ( Op { cond : Some ( cond ) , pos : pos . clone ( ) , kind : flattened . remove ( 0 ) . kind } ) ;
ops . push ( Op { cond : Some ( cond ) , pos : pos . clone ( ) , kind : flattened . remove ( 0 ) . kind } ) ;
} else {
} else {
if cond ! = Cond ::True { // evoid emiting `op.never`
ops . push ( Op {
ops . push ( Op {
kind : OpKind ::BuiltIn ( BuiltinOp ::Jump ( next_lbl . clone ( ) ) ) ,
kind : OpKind ::BuiltIn ( BuiltinOp ::Jump ( next_lbl . clone ( ) ) ) ,
pos : pos . clone ( ) ,
pos : pos . clone ( ) ,
cond : Some ( ! cond ) ,
cond : Some ( ! cond ) ,
} ) ;
} ) ;
}
ops . extend ( flattened ) ;
ops . extend ( flattened ) ;
}
}