public void MethodBegin(MethodBase methInfo, ISourceLineInfo sourceInfo, bool initWriters)
{
_methInfo = methInfo;
_ilgen = XmlILModule.DefineMethodBody(methInfo);
_lastSourceInfo = null;
#if DEBUG
if (XmlILTrace.IsEnabled) {
this.numLocals = 0;
this.symbols = new Hashtable();
this.lblNum = 0;
this.sourceFile = null;
this.writerDump = XmlILTrace.GetTraceWriter("dump.il");
this.writerDump.WriteLine(".method {0}()", methInfo.Name);
this.writerDump.WriteLine("{");
}
#endif
if (_isDebug)
{
DebugStartScope();
// DebugInfo: Sequence point just before generating code for this function
if (sourceInfo != null)
{
// Don't call DebugSequencePoint, as it puts Nop *before* the sequence point. That is
// wrong in this case, because we need source line information to be emitted before any
// IL instruction so that stepping into this function won't end up in the assembly window.
// We still guarantee that:
// 1. Two sequence points are never adjacent, since this is the 1st sequence point
// 2. Stack depth is 0, since this is the very beginning of the method
MarkSequencePoint(sourceInfo);
Emit(OpCodes.Nop);
}
}
else if (_module.EmitSymbols)
{
// For a retail build, put source information on methods only
if (sourceInfo != null)
{
MarkSequencePoint(sourceInfo);
// Set this.lastSourceInfo back to null to prevent generating additional sequence points
// in this method.
_lastSourceInfo = null;
}
}
_initWriters = false;
if (initWriters)
{
EnsureWriter();
LoadQueryRuntime();
Call(XmlILMethods.GetOutput);
Emit(OpCodes.Stloc, _locXOut);
}
}