protected override void DoEmit (EmitContext ec)
{
Label false_target = ec.DefineLabel ();
Label end;
//
// If we're a boolean constant, Resolve() already
// eliminated dead code for us.
//
Constant c = expr as Constant;
if (c != null){
c.EmitSideEffect (ec);
if (!c.IsDefaultValue)
TrueStatement.Emit (ec);
else if (FalseStatement != null)
FalseStatement.Emit (ec);
return;
}
expr.EmitBranchable (ec, false_target, false);
TrueStatement.Emit (ec);
if (FalseStatement != null){
bool branch_emitted = false;
end = ec.DefineLabel ();
if (!is_true_ret){
ec.Emit (OpCodes.Br, end);
branch_emitted = true;
}
ec.MarkLabel (false_target);
FalseStatement.Emit (ec);
if (branch_emitted)
ec.MarkLabel (end);
} else {
ec.MarkLabel (false_target);
}
}