protected override QilNode VisitNot(QilUnary ndNot) {
Label lblTemp = new Label();
// Visit operand
// Reverse branch types
switch (this.iterCurr.CurrentBranchingContext) {
case BranchingContext.OnFalse:
NestedVisitWithBranch(ndNot.Child, BranchingContext.OnTrue, this.iterCurr.LabelBranch);
break;
case BranchingContext.OnTrue:
NestedVisitWithBranch(ndNot.Child, BranchingContext.OnFalse, this.iterCurr.LabelBranch);
break;
default:
// Replace boolean argument on top of stack with its inverse
Debug.Assert(this.iterCurr.CurrentBranchingContext == BranchingContext.None);
lblTemp = this.helper.DefineLabel();
NestedVisitWithBranch(ndNot.Child, BranchingContext.OnTrue, lblTemp);
break;
}
if (this.iterCurr.CurrentBranchingContext == BranchingContext.None) {
// If condition evaluates to true, then jump to code that pushes false
this.helper.ConvBranchToBool(lblTemp, false);
this.iterCurr.Storage = StorageDescriptor.Stack(typeof(bool), false);
}
else {
this.iterCurr.Storage = StorageDescriptor.None();
}
return ndNot;
}