public virtual void ConvertToIL(IBlockStatement body) {
ITypeReference returnType = this.method.Type;
new LabelAndTryBlockAssociater(this.mostNestedTryCatchFor).Traverse(body);
Contract.Assume(this.StackSize == 0);
this.Traverse(body);
var ending = this.StackSize;
if (this.StackSize != 0) {
//
// Put a breakpoint here to find (potential) bugs in the decompiler and/or this traverser's
// tracking of the stack size. However, it cannot be enforced because when structured code
// is not completely decompiled, the resulting explicit stack instructions cannot be tracked
// accurately by this traverser. (Unstructured source code can also lead to this situation.)
//
// For instance, the following will result in both pushes being counted, but the stack size
// should increase only by one.
//
// if (c) goto L1;
// push e;
// goto L2;
// L1:
// push f;
// L2:
// an expression containing a pop value
}
this.generator.MarkLabel(this.endOfMethod);
if (this.returnLocal != null) {
this.LoadLocal(this.returnLocal);
this.generator.Emit(OperationCode.Ret);
} else if (returnType.TypeCode == PrimitiveTypeCode.Void && !this.lastStatementWasUnconditionalTransfer)
this.generator.Emit(OperationCode.Ret);
this.generator.AdjustBranchSizesToBestFit(eliminateBranchesToNext: true);
}
}