/// <summary>
/// Generates CIL for the start of every statement.
/// </summary>
/// <param name="generator"> The generator to output the CIL to. </param>
/// <param name="optimizationInfo"> Information about any optimizations that should be performed. </param>
/// <param name="locals"> Variables common to both GenerateStartOfStatement() and GenerateEndOfStatement(). </param>
public void GenerateStartOfStatement(ILGenerator generator, OptimizationInfo optimizationInfo, StatementLocals locals)
{
#if DEBUG && !SILVERLIGHT
// Statements must not produce or consume any values on the stack.
if (generator is DynamicILGenerator)
{
locals.OriginalStackSize = ((DynamicILGenerator)generator).StackSize;
}
#endif
if (locals.NonDefaultBreakStatementBehavior == false && this.HasLabels == true)
{
// Set up the information needed by the break statement.
locals.EndOfStatement = generator.CreateLabel();
optimizationInfo.PushBreakOrContinueInfo(this.Labels, locals.EndOfStatement, null, labelledOnly: true);
}
// Emit debugging information.
if (locals.NonDefaultSourceSpanBehavior == false)
{
optimizationInfo.MarkSequencePoint(generator, this.SourceSpan);
}
}